Commit Graph

394 Commits (ed40b9e3e292911ef839c758a53ce8bd09082516)

Author SHA1 Message Date
Charlie Denton ed40b9e3e2
Use assertRegex to ignore object IDs
Sometimes the tests failed because these objects had IDs that differed
from expectations. As the IDs are not relevant to this test, I have
replaced the exact string match with a regex match that accepts any ID.
2018-01-17 22:02:19 +00:00
Charlie Denton ca13180a61
Clean up unrequired compat import 2018-01-16 10:54:33 +00:00
Charlie Denton 3f6d94139c
Remove unused function in tests 2018-01-16 10:54:33 +00:00
Charlie Denton e2bf741d5d
Remove models that are not referenced in tests
This silences one instance of the warning that's being printed in tests
for versions of Django before 2.0:

> RemovedInDjango20Warning: Managers from concrete parents will soon
> qualify as default managers if they appear before any other managers
> in the MRO.
2018-01-16 10:53:35 +00:00
Charlie Denton 120520e44d
Fix `add_media` util for Django 2.0
Neither `add_css` nor `add_js` exist in Django 2.0 because the method
for adding `Media` classes together has changed.

Ref: c19b56f633
2018-01-16 10:53:34 +00:00
Charlie Denton 1a4595f5ce
Fix deprecated admin site URL in tests
The old format was deprecated in Django 1.9, and removed in Django 2.0.

Ref: https://docs.djangoproject.com/en/stable/releases/1.9/#passing-a-3-tuple-or-an-app-name-to-include
2018-01-16 10:53:34 +00:00
Charlie Denton 840bfe8d22
Fix import in Django 2.0
Because the URL mechanism has changed in Django 2.0, the
RegexURLResolver has been renamed.
2018-01-16 10:53:34 +00:00
Diederik van der Boor 7fe7861f45 Amend PR #336: fix migration file syntax for Django 1.10 2018-01-15 15:08:14 +01:00
Diederik van der Boor 38a91a8622
Merge pull request #336 from reef-technologies/bulk_create_support
Bulk create support
2018-01-15 15:03:48 +01:00
Krzysztof Gromadzki 8dc9bd2543 Review applied 2017-12-31 17:14:23 +01:00
Krzysztof Gromadzki 010a23425f Add support for bulk_create 2017-12-29 19:05:57 +01:00
Diederik van der Boor a2ba52517f Improve fix of PR #321
checking hasattr(self, 'fieldsets') alway returns true, and produces
different effects. The hasattr(self, 'declared_fieldsets') was designed
to detect whether Django injected that attribute.

Amends: 5e150ea85a
2017-12-22 10:03:13 +01:00
Tadas Dailyda 180df8e98c fix detecting whether childadmin has explicitly defined fields/fieldsets 2017-11-20 17:39:34 +02:00
Tadas Dailyda 15426dc695 further childadmin fieldsets improvements 2017-11-20 17:38:02 +02:00
Diederik van der Boor 02b71d8ba9 Improve fix of PR #321
checking hasattr(self, 'fieldsets') alway returns true, and produces
different effects. The hasattr(self, 'declared_fieldsets') was designed
to detect whether Django injected that attribute.

Amends: 5e150ea85a
2017-11-20 15:22:58 +01:00
Diederik van der Boor 8f0932b71e Fixed applabel__ModelName___field looksups
Closes: #286
2017-11-20 15:19:21 +01:00
Tadas Dailyda 5e150ea85a do not use deprecated and removed declared_fieldsets attribute in admin 2017-11-02 15:13:17 +02:00
Diederik van der Boor 04b5fb423c Make sure reset_polymorphic_ctype() supports proxy models 2017-10-08 22:43:54 +02:00
Diederik van der Boor c2768f8101 Fix support for proxy models in formsets and admin inlines 2017-10-08 22:43:54 +02:00
Diederik van der Boor cafaf95f06 Add UnsupportedChildType error for formsets
This also replaces the PolymorphicInlineModelAdmin.get_get_child_inline_instance()
and BasePolymorphicModelFormSet._construct_form() lookup with UnsupportedChildType
2017-10-08 22:33:01 +02:00
Diederik van der Boor 4d5fb4be3b fix indenting 2017-10-08 21:53:02 +02:00
Diederik van der Boor 3fe17d7a23 Provide helpful assistence to migrate code to new 1.0+ format
This makes sure the changes in 4dc20a0213
don't cause a new range of bug reports, for things like "reverse()" no
longer works.
2017-10-08 19:40:39 +02:00
Oleg Myltsyn 075f457045 Removed unnecessary translation comments (#316) 2017-10-07 01:28:34 +03:00
Diederik van der Boor 30630647c4 Add extra comment why deferred fields are skipped with ___ lookups 2017-09-30 20:26:52 +02:00
Diederik van der Boor 2e16112cbe Merge branch 'fix-defer-childs-same-polymorphic-parent' into master 2017-09-30 20:26:37 +02:00
Diederik van der Boor fb80233c5d Fix one Django-master error 2017-09-30 18:57:31 +02:00
Diederik van der Boor fab687c218 Workaround RTD error to generate the API pages 2017-09-30 18:47:03 +02:00
Diederik van der Boor c795c18575 Add admin history, add type, and add page tests 2017-09-30 18:33:19 +02:00
Diederik van der Boor a950049356 Improved and added more admin test cases 2017-09-30 18:16:59 +02:00
Diederik van der Boor 8d4cb9b151 Added rudimentary admin test cases 2017-09-30 17:47:02 +02:00
Diederik van der Boor 8caac2e57b Fixed the polymorphic inline script code.
Got broken in 0c7b1aa657 when removing
Djagno 1.8 compatibility
2017-09-30 16:50:12 +02:00
Diederik van der Boor 9f6e0716f6 Fix deleteText of |as_script_options 2017-09-30 16:46:26 +02:00
Diederik van der Boor c437524876 Improve docs of PolymorphicChildModelAdmin attributes 2017-09-30 16:35:21 +02:00
Diederik van der Boor cf0cb2478f Make the admin `base_model` setting optional.
It can be detected using get_base_polymorphic_model()
2017-09-30 16:35:02 +02:00
Diederik van der Boor 04d4181e17 Added `get_base_polymorphic_model()` to detect the common base class for a polymorphic model. 2017-09-30 16:21:21 +02:00
Diederik van der Boor 6febf7a069 Merge pull request #303 from WhyNotHugo/pgtests
Run CI with postgres too
2017-09-30 15:52:31 +02:00
Omer Strumpf bc11934c31 allowing extra arguments in get_inline_formsets 2017-09-28 12:22:13 +03:00
Hugo Osvaldo Barrera e102a0502c Update a bunch of failing tests
Tests were failing because of:

* Models weren't being imported from their new location.
* PolymorphicManager doesn't work with non-polymorphic models, but
  migrations run models' manager, so having MROBase3 with
  PolymorphicManager failed.
* Some tests failed due to have assertions were being done (since they
  hardcoded expected instance ids). Update tests to use comparisons
  similar to #312
2017-09-06 20:06:25 -03:00
Hugo Osvaldo Barrera a507345c6d Move test models into models.py and add migrations
Tests were failing on postgres due to foreign keys pointing to missing
tables.
In order for these tables to be present, we need migrations which
declare depending on `content_type`.
2017-09-06 19:47:18 -03:00
Hugo Osvaldo Barrera 80b4f2bb41 Fix failing tests with django/master
Several tests were failing with django master. This is because,
apparently, IDs don't match those expected in tests, and other
test-related details.

Replace all test comparisons with assertQuerysetEqual, which is safer
and cleaner for the sort of comparison we're doing.
2017-09-06 22:41:13 +03:00
trbs 9500a21f82 fix error with .defer and child models that use the same parent
When using .defer on a PolymorphicQuerySet with multiple childs that
subclass from the same polymorphic parent model yield an error like:

>>> Base.objects.defer('ModelY___field_y')
Traceback (most recent call last):
...
FieldDoesNotExist: ModelX has no field named 'field_y'
2017-08-30 21:17:05 +02:00
Jerome Leclanche 3af5db0ceb tests: Clean up and simplify test_reset_polymorphic_ctype 2017-08-29 19:41:42 +03:00
Jerome Leclanche a91a04af6b Set polymorphic.__version__ from setuptools metadata 2017-08-29 19:41:42 +03:00
Jerome Leclanche 300e9b062e Use field.remote_field instead of field.rel
Deprecated in Django 1.9, removed in 2.0

More information:
- https://docs.djangoproject.com/en/1.11/releases/1.9/#field-rel-changes
2017-08-29 19:41:42 +03:00
Jerome Leclanche fc8cabfa26 Replace use_for_related_fields by Meta.base_manager_name
Deprecated in 1.10, removed in 2.0

More information:
- https://code.djangoproject.com/ticket/14891
- django/django@ed0ff913c6
2017-08-29 19:41:42 +03:00
Jerome Leclanche 6fe1e2ddae Update django.urls imports 2017-08-29 19:41:42 +03:00
Jerome Leclanche 4dc20a0213 Remove Pre-1.0 compatibility hacks 2017-08-29 19:41:42 +03:00
Jerome Leclanche 0c7b1aa657 Drop support for Django 1.8 2017-08-29 19:41:42 +03:00
Diederik van der Boor 77797bfa12 Ensure consistent ordering in testing reset_polymorphic_ctype
Amends: 171d14f369
2017-08-01 13:51:42 +02:00
Diederik van der Boor 171d14f369 Improve reset_polymorphic_ctype() for reliability and test it.
This function can now be safely used on a set of models.
2017-08-01 12:17:10 +02:00