Ticket #2316: generic_patch.2.diff

File generic_patch.2.diff, 594 bytes (added by slevcom1@…, 18 years ago)

other patch had problems, this one works better

  • generic.py

     
    243243            return obj
    244244        create.alters_data = True
    245245
     246        def get_or_create(self, **kwargs):
     247            kwargs[self.content_type_field_name] = self.content_type
     248            kwargs[self.object_id_field_name] = self.pk_val
     249            return self.get_query_set().get_or_create(**kwargs)
     250        get_or_create.alters_data = True
     251
    246252    return GenericRelatedObjectManager
    247253
    248254class GenericRel(ManyToManyRel):
Back to Top