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

Improve VersionManager to using with custom managers #155

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

tbazadaykin
Copy link

Problem

VersionManager is not friendly enough to custom manager, because of:

  1. get_queryset always return VersionedQuerySet, as result it's impossible to override query set class throut from_queryset method;
  2. get_queryset has some extra code which set querytime property for query set instance. As a result user should copy this two lines - this is not a pythonic way.

Solution

  1. Move querytime-code from queryset method into querytime decorator.
  2. Some VersionManager methods use VersionedQuerySet methods, so we must ensure that they has deal with VersionedQuerySet or it's subclass. If not - we must warned user about potential problems.

Anton V. Vadaykin added 2 commits April 19, 2018 00:05
**Problem**

`VersionManager` is not friendly enough to custom manager, because of:
  1. `get_queryset` always return `VersionedQuerySet`, as result it's impossible to override query set class throut `from_queryset` method;
  1. `get_queryset` has some extra code which set `querytime` property for query set instance. As a result user should copy this two lines - this is not a pythonic way.

**Solution**
  1. Move `querytime`-code from `queryset` method into `querytime` decorator.
  1. Some `VersionManager` methods use `VersionedQuerySet` methods, so we must ensure that they has deal with `VersionedQuerySet` or it's subclass. If not - we must warned user about potential problems.
@tbazadaykin
Copy link
Author

Btw, why you add Vagrantfile into .gitignore?

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

Successfully merging this pull request may close these issues.

1 participant