class ICalendarFeed(SyndicationFeed):
- #def __init__(self, title, link, description, language=None, author_email=None,
- # author_name=None, author_link=None, subtitle=None, categories=None,
- # feed_url=None, feed_copyright=None, feed_guid=None, ttl=None, **kwargs):
- # super(ICalendarFeed, self).__init__(title, link, description, language,
- # author_email, author_name, author_link, subtitle, categories,
- # feed_url, feed_copyright, feed_guid, ttl, **kwargs)
- #
mime_type = 'text/calendar'
def add_item(self, *args, **kwargs):
('owner', self.gf('django.db.models.fields.related.ForeignKey')(related_name='owned_events', to=orm['auth.User'])),
('created', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)),
('last_modified', self.gf('django.db.models.fields.DateTimeField')(auto_now=True, blank=True)),
- ('uuid', self.gf('django.db.models.fields.TextField')()),
+ ('site', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['sites.Site'])),
))
db.send_create_signal('julian', ['Event'])
+ # Adding unique constraint on 'Event', fields ['site', 'created']
+ db.create_unique('julian_event', ['site_id', 'created'])
+
# Adding M2M table for field tags on 'Event'
db.create_table('julian_event_tags', (
('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
# Removing unique constraint on 'Calendar', fields ['name', 'site', 'language']
db.delete_unique('julian_calendar', ['name', 'site_id', 'language'])
+ # Removing unique constraint on 'Event', fields ['site', 'created']
+ db.delete_unique('julian_event', ['site_id', 'created'])
+
# Deleting model 'Location'
db.delete_table('julian_location')
'timespan_page': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'calendar_timespan_related'", 'null': 'True', 'to': "orm['philo.Page']"})
},
'julian.event': {
- 'Meta': {'object_name': 'Event'},
+ 'Meta': {'unique_together': "(('site', 'created'),)", 'object_name': 'Event'},
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'description': ('philo.models.fields.TemplateField', [], {}),
'end_date': ('django.db.models.fields.DateField', [], {}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
'owner': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'owned_events'", 'to': "orm['auth.User']"}),
'parent_event': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['julian.Event']", 'null': 'True', 'blank': 'True'}),
+ 'site': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['sites.Site']"}),
'slug': ('django.db.models.fields.SlugField', [], {'max_length': '255', 'db_index': 'True'}),
'start_date': ('django.db.models.fields.DateField', [], {}),
'start_time': ('django.db.models.fields.TimeField', [], {'null': 'True', 'blank': 'True'}),
- 'tags': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'events'", 'null': 'True', 'symmetrical': 'False', 'to': "orm['philo.Tag']"}),
- 'uuid': ('django.db.models.fields.TextField', [], {})
+ 'tags': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'events'", 'null': 'True', 'symmetrical': 'False', 'to': "orm['philo.Tag']"})
},
'julian.location': {
'Meta': {'object_name': 'Location'},
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