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

The delete method of Versionable raises an error #136

Open
gabn88 opened this issue May 10, 2017 · 0 comments
Open

The delete method of Versionable raises an error #136

gabn88 opened this issue May 10, 2017 · 0 comments

Comments

@gabn88
Copy link

gabn88 commented May 10, 2017

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'

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant