raise ValidationError("A %s cannot end before it starts." % self.__class__.__name__)
def get_start(self):
- return self.start_date
+ return datetime.datetime.combine(self.start_date, self.start_time) if self.start_time else self.start_date
def get_end(self):
- return self.end_date
+ return datetime.datetime.combine(self.end_date, self.end_time) if self.end_time else self.end_date
class Meta:
abstract = True
created = models.DateTimeField(auto_now_add=True)
last_modified = models.DateTimeField(auto_now=True)
- uuid = models.TextField() # Format?
+
+ site = models.ForeignKey(Site, default=DEFAULT_SITE)
+
+ @property
+ def uuid(self):
+ return "%s@%s" % (self.created.isoformat(), getattr(self.site, 'domain', 'None'))
objects = EventManager()
def __unicode__(self):
return self.name
+
+ class Meta:
+ unique_together = ('site', 'created')
class Calendar(Entity):
def __unicode__(self):
return self.name
+ @property
+ def fpi(self):
+ # See http://xml.coverpages.org/tauber-fpi.html or ISO 9070:1991 for format information.
+ return "-//%s//%s//%s" % (self.site.name, self.name, self.language.split('-')[0].upper())
+
class Meta:
unique_together = ('name', 'site', 'language')
return ""
def feed_guid(self, obj):
- # Is this correct? Should I have a different id for different subfeeds?
- # See http://xml.coverpages.org/tauber-fpi.html for format.
- return "-//%s//%s %s//%s" % (obj.site.name.upper(), self.feed_type.upper(), obj.name.upper(), obj.language.upper())
+ return obj.fpi
def description(self, obj):
return obj.description