Commit Graph

455 Commits (37322a75f781a0177861acc45e8b0366140260d1)

Author SHA1 Message Date
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
Ben Konrath 102817e54c Update DB settings for Django >= 1.4. 2013-03-18 20:47:16 +01:00
Ben Konrath 25821cd4da Add tox configuration file.
Note: The tests do not currently pass.
2013-03-18 20:11:03 +01:00
Chris Glass 6b7edd06a6 Merge pull request #21 from vdboor/master
Remove unused load statements in add_type_form.html
2013-03-18 07:37:13 -07: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
Chris Glass 51b789cdc6 Point release fixes a merge error. 2013-02-28 11:27:51 +01:00
Chris Glass c1d00ed5c1 Merge branch 'master' of github.com:chrisglass/django_polymorphic 2013-02-28 11:26:44 +01:00
Chris Glass 72e1a144c1 Bumped setup.py version, Changes, for 0.3 release 2013-02-28 11:22:31 +01:00
Chris Glass 2c1c5d7630 Merge pull request #12 from vdboor/master
Avoid SQL query in pre_save_polymorphic()
2013-02-24 05:07:07 -08:00
Chris Glass c22e50662d Merge branch 'install-admin-templates' of https://github.com/onepercentclub/django_polymorphic into onepercentclub-install-admin-templates
Conflicts:
	MANIFEST.in
2013-02-24 14:04:31 +01:00
Chris Glass 183d69ae87 Merge pull request #14 from thenewguy/master
remove trailing slash
2013-01-31 12:45:32 -08:00
gordon 9de33bd172 remove trailing '/' 2012-12-16 19:22:02 -05:00
Ben Konrath e5eaaa987c Include templates in install. 2012-12-10 18:02:12 +01:00
Ben Konrath eee5dda5ba Small admin documentation fix. 2012-12-10 15:41:45 +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
Chris Glass 28b8885236 Merge pull request #10 from vdboor/master
Polymorphic admin interface
2012-08-06 01:39:08 -07:00
Diederik van der Boor bba8db1210 Also update the DOCS for the get_child_models() admin change. 2012-07-24 21:55:01 +02: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 d5b1b6b56c Fix settings.py for Django 1.4 2012-07-13 17:44:37 +02:00
Diederik van der Boor a6d62ed630 Update the example app to demonstrate the polymorphic admin
This really begs for a separate folder, but I leave that to a new commit
for now.
2012-07-13 16:01:58 +02:00
Diederik van der Boor 42d525a895 Added `url` in setup.py, so sdist actually works again. 2012-07-13 16:01:58 +02:00
Diederik van der Boor 0950b86ca9 Added requires files to MANIFEST.in and setup.py 2012-07-13 16:01:58 +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
Diederik van der Boor 5d65bf4bbc Added polymorphic admin interface
Extracted from django-fluent-pages, ready for other apps too.
The polymorphic admin is implemented via a parent admin for the base
model, and separate admin interfaces for the child models.

The parent model needs to inherit PolymorphicParentModelAdmin,
and override `get_admin_for_model()` and `get_child_model_classes()`
to find the child admin interfaces.

The derived models have their own `ModelAdmin` class, which inherits
from `PolymorphicChildModelAdmin`. The parent admin redirects it's
change and delete views to the child admin.

By adding `polymorphic` to the INSTALLED_APPS, the breadcrumbs will be
fixed as well, to remain unchanged between the child applications.
2012-07-05 23:16:46 +02:00
Chris Glass db4cc4dc3b Merge pull request #5 from ojii/patch-1
Explicit is better than implicit
2012-01-09 07:48:57 -08:00
Jonas Obrist 870091c13f Explicit is better than implicit 2012-01-09 16:47:59 +01:00
Christopher Glass a5a517532f Added Germán to AUTHORS.rst
Thanks a lot for your contribution
2011-12-20 19:01:13 +00:00
German M. Bravo f987818fe4 PEP 8 cleaning
Conflicts:

	polymorphic/__init__.py
	polymorphic/polymorphic_model.py
2011-12-20 18:59:50 +00:00
German M. Bravo c9922d8987 PEP 8 cleaning 2011-12-20 18:59:50 +00:00
German M. Bravo bb06d6d12b Some more PEP 8 cleaning 2011-12-20 18:59:25 +00:00
Christopher Glass 741abf4228 Cleanup AUTHORS.rst 2011-12-20 18:56:37 +00:00
Chris Glass 11daac4fef Merge pull request #3 from mbrochh/dont_use_attrs
Not using attrs when getting the first user defined manager.
2011-12-20 10:53:00 -08:00
Christopher Glass ce97087f78 Started cleaning up
Now that the line was drawn, it's time for cleanups and improvements.
2011-12-20 18:51:05 +00:00
Christopher Glass 60813621a1 Drew the line between legacy and new code.
Since the original author disappeared, this commit marks the line between what
he did and what enhancements we (the community of maintainers) bring to the
project.
2011-12-20 18:49:20 +00:00
Martin Brochhaus dfc8eff1e1 Not using attrs when getting the first user defined manager. 2011-12-09 15:22:38 +08:00
Chris Glass 227810c49f Removed homepage URL from python packaging (this broke pip, as usual) 2011-08-02 14:18:04 +02:00
Chris Glass c7cbfc0e23 Removed dead imports. 2011-05-19 15:16:39 +02:00
Jonas Obrist 10b8901088 Edited polymorphic/showfields.py via GitHub 2011-05-19 06:08:39 -07:00
Jonas Obrist 30f11a35d7 Edited polymorphic/query_translate.py via GitHub 2011-05-19 06:07:25 -07:00
Jonas Obrist 6f8e31222d PEP-8, it's a thing! 2011-05-19 06:05:49 -07:00
Jonas Obrist ba2cb60c9d Edited polymorphic/polymorphic_model.py via GitHub 2011-05-19 06:04:23 -07:00
Jonas Obrist fabae70ed4 protip: after a colon in python, HIT THE ENTER KEY! 2011-05-19 06:02:53 -07:00
Jonas Obrist f42c58c0d4 it's python, not javascript! 2011-05-19 06:01:07 -07:00
Chris Glass 7b49fd133f Added packaging stuff to gitignore, created MANIFEST include (to ship the
license and docs etc...)
2011-04-27 11:20:34 +02:00
Chris Glass 000d480dfb Fixed typo 2011-04-27 11:11:31 +02:00