An event can have a user, application or page as an owner. So say we have:
class FacebookEvent(models.Model):
#@todo Venue
id = models.BigIntegerField(primary_key=True)
content_type = models.ForeignKey(ContentType, blank=True, null=True)
object_id = models.PositiveIntegerField(blank=True, null=True)
owner = generic.GenericForeignKey('content_type', 'object_id')
We will run into an issue because while FacebookPage and FacebookApplication only have one object, FacebookUser will have several.
If we create multiple FacebookEvent, we'll have duplicate primary keys.
If we have an application with a facebook user that hasn't given read rights to events, presumably we'll see things we shouldn't.
We could swap owner to a PositiveIntegerField, but then if we want to get the owner as an object we would need to query pages, application and user.
Possibly each FacebookEvent should relate to a facebook application, and then it could have a single owner.
If we find that we must relate FacbeookEvent to a single application (seems likely) wouldn't that also imply we should sope everything on the FacebookApplication, like FacebookPage as presumably some applications don't have manage_pages set, but we could decorate FacebookPage with information that is derives from insights, manage pages or things like that.
An event can have a user, application or page as an owner. So say we have:
FacebookPage
andFacebookApplication
only have one object,FacebookUser
will have several.PositiveIntegerField
, but then if we want to get the owner as an object we would need to query pages, application and user.