Commit Graph

96 Commits (ff22332d2c8a427fc6cfe5bc80872a081783afb8)

Author SHA1 Message Date
Diederik van der Boor ff22332d2c Remove Django 1.1 compatibility switch 2013-05-20 23:54:45 +02:00
Diederik van der Boor fed810b336 Update version numbers for 0.5 release 2013-05-20 18:03:35 +02:00
Diederik van der Boor 83238697d2 Setup.py: update trove classifiers, read version from code. 2013-05-20 17:12:38 +02:00
Diederik van der Boor 4d7d33ed0d Port new code to Python 3 as well, fix six.with_metaclass() issues
Many thanks to @atheiste for the big porting steps!
2013-05-20 16:03:21 +02:00
Tomas Peterka cbf52a61af Porting to Python 3.2
Removed compatibility_tools (because we aim to Python 2.7 and Python 3.2)
Performed 2to3 and modified
Usage of django.utils.six which adds dependency on Django >= 1.4.2
2013-05-20 16:03:21 +02:00
Diederik van der Boor c933be9c24 Port documentation to Sphinx, cleanup README 2013-05-19 17:15:41 +02:00
Diederik van der Boor 8cf313335c Handle stale ContentType models (no longer referring to a model)
This builds on top of a fix in Django 1.6, and has a workaround for
Django 1.4 and 1.5. When the base class points to a model that no longer
exists, it will be silently dropped in the polymorphic queryset results.

This behavior is identical to iterating over results when the derived
table doesn't have the object anymore.
2013-05-19 14:35:29 +02:00
Chris Glass 8527244cb3 Bumped versio to .dev0 2013-04-10 14:23:29 +02:00
Chris Glass 7d562511ba Version 0.4.2 proper 2013-04-10 14:18:55 +02:00
Chris Glass 9b9838116d Bumped version to 0.4.2
Previous verison had a broken setup.py
2013-04-10 14:15:05 +02:00
Chris Glass 3a29da5133 Bumped version to 0.4.1 2013-04-10 14:11:06 +02:00
Chris Glass e38b7002f4 Merge branch 'master' of github.com:chrisglass/django_polymorphic 2013-04-10 14:10:15 +02:00
Chris Glass 9c5c6c5136 Made the version number logic saner 2013-04-10 14:09:46 +02:00
Diederik van der Boor 4106ad7296 Apply list filter in example app 2013-04-08 00:37:51 +02:00
floppya a214cd58f7 Adds admin list filter for polymorphic child models. 2013-04-08 00:35:55 +02:00
Adam Wentz 04dce421e5 Fixes PolymorphicQuerySet for django 1.6
QuerySet.dup_select_related has been removed.
2013-04-08 00:35:22 +02:00
Diederik van der Boor bb0a4daddc Optimize transmogrify() function, assign __class__ instead. 2013-04-08 00:32:06 +02:00
floppya 54cf2f37d8 Updated proxy model tests
Extracted classes from original proxy test.
Added another simple proxy model test.
Moved the test case to a seemingly better spot.
2013-04-08 00:32:06 +02:00
floppya 20ac209dbb Fixes proxy models in the admin
The PolymorphicParentModelAdmin was getting the concrete model ids for
the add form.
2013-04-08 00:32:06 +02:00
Jedediah Smith 1a6f3a45e5 Handle non-distinct results from base object query 2013-04-08 00:32:06 +02:00
Diederik van der Boor ea9cb91e78 Rename variables in polymorphic/query.py for clarity
(split from previous commit by @jedediah)
2013-04-08 00:32:06 +02:00
Diederik van der Boor 19d5ed2338 Fix base_manager unit test
As more methods are added to the PolymorphicModel, the attr dict changes
ordering in the meta class. By making the ordering of managers
consistent, this problem no longer occurs.
2013-04-08 00:32:02 +02:00
Jedediah Smith 58c4f6f697 Optimization - don't do extra queries for proxy models 2013-04-08 00:05:21 +02:00
floppya 74389bb23d Update for proxy models and Django 1.5
Only monkeypatch when using Django < 1.5
Updated test
2013-04-08 00:05:21 +02:00
Jedediah Smith e2cfbf3898 Support proxy models (still requires one query per proxied model, not optimal) 2013-04-07 23:36:09 +02:00
Diederik van der Boor 78253bfe12 Fix passing custom querysets to related managers.
* The custom manager was not assigned to _default_manager;
  get_first_user_defined_manager() always returned None
* The PolymorphicManager couldn't remember it's custom queryset;
  a RelatedManager creates a new instance of a manager, so the queryset
  parameter should be known at class-level, not object level.
* The old method of providing a custom queryset class has been deprecated.
2013-04-07 01:39:58 +02:00
Diederik van der Boor 1f26302632 Fix Django 1.5 support, tests pass again.
The reason polymorphic broke was because it couldn't find some managers
anymore in the inheritance tree. Django 1.5 removes these and replaces
them with an `AbstractManagerDescriptor`. This patch restores those objects
2013-04-07 00:43:41 +02:00
Diederik van der Boor ca4067e279 Add proxy model test that fails in Django 1.5 2013-04-05 17:36:50 +02:00
Chris Glass 62d97f29b1 Merge pull request #30 from vdboor/cleanup_for_15
Cleanup before porting to Django 1.5
2013-04-05 03:09:42 -07:00
Diederik van der Boor e411660b80 Tests: fix missed error in last commit
(cannot amend, already pushed for review)
2013-04-05 12:01:44 +02:00
Diederik van der Boor ebced5f4eb Tests: make old code more readable 2013-04-05 11:45:07 +02:00
Diederik van der Boor 7ca328f9e4 Tests: auto removed unused imports 2013-04-05 11:39:57 +02:00
Diederik van der Boor 2d83124f51 Tests: remove Django 1.1 compatibility check 2013-04-05 11:38:56 +02:00
Diederik van der Boor 25aa32d7bd Replaced the doctests with unit tests
Making debugging tests much easier. The same repr() logic is preserved,
so this is essentually a huge coding style change.
2013-04-05 11:33:41 +02:00
Diederik van der Boor 32426aa41a Use self.assertEqual() in tests instead of assert statement. 2013-04-05 09:54:48 +02:00
Julian Wachholz a6f8429aae django.conf.urls.defaults is deprecated; use django.conf.urls instead 2013-04-04 23:41:07 +03:00
Diederik van der Boor e7a2340723 Remove polymorphic_dumpdata command and assorted scripts.
The polymorphic_dumpdata command carried a deprecation note for a long
time now. The scripts for testing python versions are replaced by tox already.
2013-03-28 14:16:45 +01:00
Chris Glass 30172d3110 Merge pull request #24 from onepercentclub/port-regression-doctest-to-unit-test
Port regression doctest to unit test
2013-03-25 02:04:07 -07:00
Ben Konrath 8e4697c741 Port regression doctest to unit test. 2013-03-18 22:33:55 +01:00
Ben Konrath dc6f41c7e9 Update URLs to github hosted webpage. 2013-03-18 21:27:23 +01:00
Ben Konrath 318dd3d67a Fixed the default manager test failures.
According to the django docs (1.4 / 1.5), the default manager for subclasses of
PolymorphicModel should be PolymorphicManager:

3. The default manager on a class is either the first manager declared on the
   class, if that exists, or the default manager of the first abstract base
   class in the parent hierarchy, if that exists. If no default manager is
   explicitly declared, Django’s normal default manager is used.

https://docs.djangoproject.com/en/1.4/topics/db/managers/#custom-managers-and-model-inheritance
https://docs.djangoproject.com/en/1.5/topics/db/managers/#custom-managers-and-model-inheritance
2013-03-18 20:56:12 +01:00
Ben Konrath b718acf005 Update db_type method for Django >= 1.4 DB settings format. 2013-03-18 20:50:45 +01:00
Ben Konrath 1ef9e068df Import settings in tests from django.conf. 2013-03-18 20:47:56 +01:00
Diederik van der Boor 720a189f5a Remove unused load statements in add_type_form.html
This addresses Django 1.5 compatibility as well (see #16)
2013-03-18 12:15:10 +01:00
Diederik van der Boor f687dc18b1 SQL optimization, avoid query in pre_save_polymorphic()
This query is visible in the django-debug-toolbar POST redirect page
2012-11-15 10:42:02 +01:00
Diederik van der Boor 0d5f2fd943 Change the child model registration to fix raw_id_fields.
As discovered in django-polymorphic-tree and django-fluent-pages,
the raw_id_fields didn't work in Django 1.4 because the fields actively
check which models are actually registered in the admin site.

Hence, the parent admin site _registry is inserted in the child admin as
well. This also completely moves the initialisation of the child admin
into this class, using a `get_child_models()` function,
akin to the static `child_models` attribute.
2012-07-24 21:50:52 +02:00
Diederik van der Boor 0b608cc67e Minor extension: allow apps to override the type label in the add form easily
When overriding apps, this turns out to be a very useful feature to
have.
2012-07-18 00:51:34 +02:00
Diederik van der Boor 8d426d9243 Remove abc marker because methods are no longer abstract 2012-07-13 18:29:02 +02:00
Diederik van der Boor b2e308d30c Improve PolymorphicParentAdmin, simplify, fix templates
During the development of django-polymorphic-tree it was discovered that
the PolymorphicParentModelAdmin could actually be made much simpler.
It features a `child_models` attribute now, so there is very little code
needed to actually implement a polymorphic admin now.

Also found various issues which are together fixed in this commit for
pulling.
2012-07-13 16:01:58 +02:00
Diederik van der Boor 2e76811adb Adding PolymorphicChildModelAdmin to __all__ as well 2012-07-05 23:27:34 +02:00