Skip to content
This repository was archived by the owner on Feb 7, 2019. It is now read-only.
This repository was archived by the owner on Feb 7, 2019. It is now read-only.

The delete method of Versionable raises an error #136

Description

@gabn88

This is how I imported cleanerversion:

class CustomerQuerySet(VersionedQuerySet):
    def my_custom_filter(self, something):
        pass

class CustomerManager(VersionManager):
    def get_queryset(self):
        return CustomerQuerySet(self.model, using=self._db)

    def my_custom_filter(self):
        return self.get_queryset().my_custom_filter()
 
@python_2_unicode_compatible       
class Customer(Versionable, AbstractAddress):

This is where it goes wrong on VersionManager (I set a trace to find it):

    def delete(self, using=None):
        using = using or router.db_for_write(self.__class__, instance=self)
        assert self._get_pk_val() is not None, \
            "{} object can't be deleted because its {} attribute is set to None.".format(
                self._meta.object_name, self._meta.pk.attname)

        collector_class = get_versioned_delete_collector_class()
        collector = collector_class(using=using)
        collector.collect([self])
        collector.delete(get_utc_now())

on collector.collect([self]) an error is raised:
AttributeError: 'Manager' object has no attribute 'current'

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions