cleanerversion
cleanerversion copied to clipboard
Improve `VersionManager` to using with custom managers
Problem
VersionManager
is not friendly enough to custom manager, because of:
-
get_queryset
always returnVersionedQuerySet
, as result it's impossible to override query set class throutfrom_queryset
method; -
get_queryset
has some extra code which setquerytime
property for query set instance. As a result user should copy this two lines - this is not a pythonic way.
Solution
- Move
querytime
-code fromqueryset
method intoquerytime
decorator. - Some
VersionManager
methods useVersionedQuerySet
methods, so we must ensure that they has deal withVersionedQuerySet
or it's subclass. If not - we must warned user about potential problems.
Btw, why you add Vagrantfile
into .gitignore
?