Commit 73af1f0a authored by Rafal's avatar Rafal

add description, icon_www

parent 4c7196ee
...@@ -10,20 +10,20 @@ class Command(BaseCommand): ...@@ -10,20 +10,20 @@ class Command(BaseCommand):
def handle(self, *args, **options): def handle(self, *args, **options):
apis = [ apis = [
['Apteki w Krakowie', 'Krakow', 'map', 'apteki'], ['Apteki w Krakowie', 'Krakow', 'map', 'apteki', '', 'Opis API o aptekach w Krakowie'],
['Baseny w Krakowie', 'Krakow', 'map', 'baseny'], ['Baseny w Krakowie', 'Krakow', 'map', 'baseny', '', 'Opis API o aptekach w Krakowie'],
['Hotele w Krakowie', 'Krakow', 'map',' hotele'], ['Hotele w Krakowie', 'Krakow', 'map',' hotele', '', 'Opis API o aptekach w Krakowie'],
['HotSpoty w Krakowie', 'Krakow', 'map',' mapaHotSpotow'], ['HotSpoty w Krakowie', 'Krakow', 'map',' mapaHotSpotow', '', 'Opis API o aptekach w Krakowie'],
['Utrudnienia w Krakowie', 'Krakow', 'map',' mapaUtrudnien'], ['Utrudnienia w Krakowie', 'Krakow', 'map',' mapaUtrudnien', '', 'Opis API o aptekach w Krakowie'],
['Restauracje w Krakowie', 'Krakow', 'map',' restauracje'], ['Restauracje w Krakowie', 'Krakow', 'map',' restauracje', '', 'Opis API o aptekach w Krakowie'],
['Szpitale w Krakowie', 'Krakow', 'map',' szpitale'], ['Szpitale w Krakowie', 'Krakow', 'map',' szpitale', '', 'Opis API o aptekach w Krakowie'],
['Zdarzenia drogowe w Krakowie', 'Krakow', 'map',' zdarzeniaDrogowe'], ['Zdarzenia drogowe w Krakowie', 'Krakow', 'map',' zdarzeniaDrogowe', '', 'Opis API o aptekach w Krakowie'],
] ]
print "Creating APIs" print "Creating APIs"
for api in apis: for api in apis:
print "Create {0}".format(api[0]) print "Create {0}".format(api[0])
tag = Tag.objects.filter(name=api[1])[0] tag = Tag.objects.filter(name=api[1])[0]
api_type = APIType.objects.filter(name=api[2])[0] api_type = APIType.objects.filter(name=api[2])[0]
new_api = API.objects.create(name=api[0], type=api_type, source=api[3]) new_api = API.objects.create(name=api[0], type=api_type, source=api[3], icon_www=api[4], description = api[5])
new_api.tag = [tag, ] new_api.tag = [tag, ]
new_api.save() new_api.save()
\ No newline at end of file
...@@ -18,6 +18,8 @@ class API(models.Model): ...@@ -18,6 +18,8 @@ class API(models.Model):
type = models.ForeignKey(APIType, related_name='API_type', type = models.ForeignKey(APIType, related_name='API_type',
blank=False, null=False, default=None) blank=False, null=False, default=None)
source = models.CharField(max_length=100) source = models.CharField(max_length=100)
icon_www = models.CharField(max_length=100, default=None, null=True, blank=True)
description = models.CharField(max_length=300, default=None, null=True, blank=True)
def __str__(self): def __str__(self):
......
...@@ -6,7 +6,7 @@ class APISerializer(serializers.HyperlinkedModelSerializer): ...@@ -6,7 +6,7 @@ class APISerializer(serializers.HyperlinkedModelSerializer):
class Meta: class Meta:
model = API model = API
fields = ('url', 'name', 'tag' ,'type', 'source') fields = ('url', 'name', 'tag' ,'type', 'source', 'icon_www', 'description')
class APITypeSerializer(serializers.HyperlinkedModelSerializer): class APITypeSerializer(serializers.HyperlinkedModelSerializer):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment