From 699add44c50c9ed6539cb572ce6bff6cfe7e1fa2 Mon Sep 17 00:00:00 2001 From: sanj Date: Mon, 25 Oct 2010 14:48:29 +0200 Subject: [PATCH] models, minor fixes --- rizk/egypt/models.py | 84 +++----------------------------------------- 1 file changed, 4 insertions(+), 80 deletions(-) diff --git a/rizk/egypt/models.py b/rizk/egypt/models.py index 7925d94..0eedb71 100644 --- a/rizk/egypt/models.py +++ b/rizk/egypt/models.py @@ -48,7 +48,7 @@ class Image(models.Model): url = models.URLField("FlickR URL") caption = models.CharField(max_length=255, blank=True, null=True) # category = models.ForeignKey("ImageCategory") - date = models.DateField(null=True) + event = models.ForeignKey("Event") location = models.ForeignKey(Location) flickrData = models.TextField(blank=True, editable=False) @@ -79,29 +79,6 @@ class Image(models.Model): self.save() return ret -''' -class ImageCategory(models.Model): - name = models.CharField(max_length=255) - description = models.TextField(blank=True, null=True) - - def __unicode__(self): - return self.name - - def get_dict(self): - images = [] - flyovers = [] - for i in Image.objects.filter(category=self): - images.append(i.get_dict()) - flyovers.append(i.flyover.geojson_as_dict()) - return { - 'images': images, - 'flyovers': { - 'type': 'FeatureCollection', - 'features': flyovers - } - } -''' - class Event(models.Model): name = models.CharField(max_length=255) description = models.TextField(blank=True) @@ -154,7 +131,7 @@ class YoutubeVideo(models.Model): youtubeData = models.TextField(blank=True, editable=False) def __unicode__(self): - return self.url + " - " + self.caption + " - " + self.category.name + return self.url + " - " + self.caption def get_youtube_id(self): reg = r'http.*?v=(.*?)$' @@ -183,47 +160,16 @@ class YoutubeVideo(models.Model): self.save() return ret -''' -class VideoCategory(models.Model): - name = models.CharField(max_length=255) - description = models.TextField(blank=True, null=True) - - def __unicode__(self): - return self.name - - def get_dict(self): - videos = [] - flyovers = [] - for v in Video.objects.filter(category=self): - videos.append(v.get_dict()) - flyovers.append(v.flyover.geojson_as_dict()) - return { - 'videos': videos, - 'flyovers': { - 'type': 'FeatureCollection', - 'features': flyovers - } - } -''' - class Audio(models.Model): fil = models.FileField(upload_to='audio/') caption = models.CharField(max_length=255, blank=True, null=True) txt = models.TextField(blank=True) # category = models.ForeignKey("AudioCategory") location = models.ForeignKey(Location) + event = models.ForeignKey("Event") def __unicode__(self): - return self.url + " - " + self.caption + " - " + self.category.name - -''' -class AudioCategory(models.Model): - name = models.CharField(max_length=255) - description = models.TextField(blank=True, null=True) - - def __unicode__(self): - return self.name -''' + return self.url + " - " + self.caption class Text(models.Model): # url = models.URLField("FlickR URL") @@ -247,26 +193,4 @@ class Text(models.Model): -''' -class TextCategory(models.Model): - name = models.CharField(max_length=255) - description = models.TextField(blank=True, null=True) - - def __unicode__(self): - return self.name - - def get_dict(self): - texts = [] - flyovers = [] - for t in Text.objects.filter(category=self): - texts.append(t.get_dict()) - flyovers.append(t.flyover.geojson_as_dict()) - return { - 'texts': texts, - 'flyovers': { - 'type': 'FeatureCollection', - 'features': flyovers - } - } -''' # Create your models here.