Browse files

Merge pull request #31 from jangeador/master

Fixes problems where models primary key is not named `id`
  • Loading branch information...
2 parents 285ba4a + cc43e34 commit 6377c0b381b8570e65f4e837f75d328f6a63ba3f @bartTC committed on GitHub Aug 20, 2016
Showing with 2 additions and 2 deletions.
  1. +1 −1 attachments/forms.py
  2. +1 −1 attachments/models.py
View
2 attachments/forms.py
@@ -15,5 +15,5 @@ class Meta:
def save(self, request, obj, *args, **kwargs):
self.instance.creator = request.user
self.instance.content_type = ContentType.objects.get_for_model(obj)
- self.instance.object_id = obj.id
+ self.instance.object_id = obj.pk
super(AttachmentForm, self).save(*args, **kwargs)
View
2 attachments/models.py
@@ -22,7 +22,7 @@ class AttachmentManager(models.Manager):
def attachments_for_object(self, obj):
object_type = ContentType.objects.get_for_model(obj)
return self.filter(content_type__pk=object_type.id,
- object_id=obj.id)
+ object_id=obj.pk)
class Attachment(models.Model):

0 comments on commit 6377c0b

Please sign in to comment.