Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- models.py:
- class Key(models.Model):
- """Authentication key"""
- user = models.ForeignKey(User, editable=False, db_index=True, blank=False,
- null=False)
- key = models.CharField(_("Lookup key"), max_length=64,
- editable=False, db_index=True)
- hashed_secret = models.CharField(_("Hashed secret"), max_length=128,
- editable=False, db_index=False)
- description = models.TextField(_("Description of intended use"),
- blank=False)
- created = models.DateTimeField(auto_now_add=True)
- class KeyAction(models.Model):
- """Record of an action taken while using a key"""
- key = models.ForeignKey(Key, related_name='history', db_index=True)
- action = models.CharField(max_length=128, blank=False)
- notes = models.TextField(null=True)
- content_type = models.ForeignKey(ContentType)
- object_id = models.PositiveIntegerField()
- content_object = generic.GenericForeignKey('content_type', 'object_id')
- created = models.DateTimeField(auto_now_add=True)
- 0003_remove_authkeys.py:
- def forwards(self, orm):
- "Write your forwards methods here."
- (orm.Key.objects.all().exclude(
- id__in=orm.KeyAction.objects.values_list('id', flat=True)
- .delete()))
- Traceback:
- File "/home/vagrant/src/kuma/authkeys/migrations/0003_remove_authkeys.py", line 15, in forwards
- id__in=KeyAction.objects.values_list('id', flat=True)
- File "/home/vagrant/src/vendor/src/django/django/db/models/query.py", line 513, in delete
- collector.collect(del_query)
- File "/home/vagrant/src/vendor/src/django/django/db/models/deletion.py", line 159, in collect
- for parent_model, ptr in model._meta.parents.iteritems():
- AttributeError: type object 'long' has no attribute '_meta'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement