models, minor fixes

This commit is contained in:
sanj 2010-10-25 14:48:29 +02:00
parent 75f75e986d
commit 699add44c5

View File

@ -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.