Commit graph

67 commits

Author SHA1 Message Date
Jacek Tomaszewski
656dca3e40 Show None checkboxes on form fields, especially admin (close #187). 2013-10-10 23:05:26 +02:00
Jacek Tomaszewski
c7f0eee273 Don't import individual settings. 2013-10-10 16:47:56 +02:00
Jacek Tomaszewski
489e2db145 Merge remote branch.
Fix _patch_prepopulated_fields (close #190, #181).
2013-10-10 16:45:39 +02:00
Jacek Tomaszewski
74df71bdf2 Merge pull request #163 from wrwrwr/feature/no-empty-string-fallback-for-nullable
Fallback on field default rather than the empty string
2013-09-01 10:52:00 -07:00
Konrad Wojas
b9d8359306 Added MODELTRANSLATION_PREPOPULATE_LANGUAGE setting to force prepopulated fields (slugs) to use a specific language as their source 2013-07-23 16:07:41 +08:00
Rafleze
23ca52ceef Update admin.py
Improvements on _patch_prepopulated_fields
2013-07-08 21:22:58 +02:00
wrwrwr
027349bd9a Set self to something in the replace_orig_field doctest, so PyFlakes doesn't complain. 2013-05-15 12:37:14 +02:00
wrwrwr
7cd60aa977 Added a small script unchecking the clear box after a wrapped input is edited.
Note: Starting global declaration, and the somewhat ugly jQuery call are for JSLint.
Also written a class comment for the widget wrapper and cleaned up some Flake8 errors.
2013-05-15 12:01:46 +02:00
wrwrwr
22faea9646 Reworked the solution by replacing clearable widgets with a widget wrapper. This makes it possible to wrap only widgets of nullable fields, and thus not add the clear checkbox when it's not needed.
The implementation is loosely based on RelatedFieldWidgetWrapper from contrib.admin, but uses a bit more Python magic; tested only with TextInput and Textarea widgets and their admin counterparts, but with a bit of luck should work with other widgets too.
2013-05-14 22:21:03 +02:00
wrwrwr
b9494f7607 Merge branch 'master' into feature/no-empty-string-fallback-for-nullable
Conflicts:
	modeltranslation/admin.py
	modeltranslation/fields.py
	modeltranslation/translator.py
2013-05-13 13:34:37 +02:00
Jacek Tomaszewski
e04073a7ec Preserve default fields order in group_fieldsets. 2013-04-08 11:41:06 +02:00
Jacek Tomaszewski
b7ea1fac4c Further work towards Python 3 support. 2013-04-08 11:41:06 +02:00
deschler
2d63001edd Added convenience admin classes for easier inclusion of tabbed translation fields static files (closes #171). 2013-04-05 02:14:59 +02:00
wrwrwr
97d966244d Implemented a widget that shows a clear checkbox for any non-required form field.
Overriden admin widgets of CharFields and TextFields and patched forms.CharField for nullable fields, so undefined translations don't get filled with empty strings when an admin form is saved (thus becoming defined in the case of a nullable field).
2013-03-24 17:59:21 +01:00
Dirk Eschler
1dcdc1ebfe Simplified exclusion of translation fields in grouped_fieldsets (thanks to Wojtek Ruszczewski for poiting this out). 2013-02-26 10:49:33 +01:00
Dirk Eschler
9a6267838e Added missing hook for get_readonly_fields. Potential fix for issue #140. 2013-02-13 12:18:10 +01:00
Dirk Eschler
4ca3c103e5 Fixed prepopulated fields only work on the first defined field and made function aware of the current language. Added a unittest to verify. Resolves issue #57. 2013-02-12 15:53:00 +01:00
Dirk Eschler
2ab73babe0 Small optimization, don't loop twice over trans_fields. 2013-02-12 12:33:33 +01:00
Dirk Eschler
6c66cec35e Honoured options like exclude for translation fields and assured that we don't end up with empty fields in untranslated fieldsets. 2013-02-12 12:17:27 +01:00
Dirk Eschler
e6b05d1a7f Sorted translation fields by fieldname. 2013-02-12 10:40:26 +01:00
Dirk Eschler
dbcff0d2df Moved group_fieldsets to class. 2013-02-12 10:30:00 +01:00
deschler
9996ef39cd Added a new group_fieldsets option to TranslationAdmin to group fieldsets by translation fields. An approach to issue #38. Based on initial code by Chris Adams. Adopted and enhanced for the latest admin refactoring. The new option currently defaults to False and has to be activated on demand. 2013-02-11 22:29:58 +01:00
wrwrwr
772d51c1c3 Adapt admin to new translation options, allowing it to manage translation fields inherited from concrete supermodels.
``TranslationOptions.localized_fieldnames_rev`` is no longer available, but should be replaceable by field.translated_field (may be readded as a ``TranslationOptions`` method if it's useful for something).
2013-02-10 18:28:06 +01:00
Dirk Eschler
e94bbcd3d2 Applied styleguide. We allow 100 chars now, let's use the space. 2013-02-06 11:52:46 +01:00
Dirk Eschler
f38ab0ce6e Minor cleanups. 2012-11-20 20:48:26 +01:00
Dirk Eschler
ee380ec7b7 Handled nested lists to display multiple fields on same line by flatting them. 2012-11-20 01:02:12 +01:00
Dirk Eschler
4dbbfee1ce Validated against flake8. 2012-11-18 21:36:10 +01:00
sbrandtb
afb9f5436d Fixed #111: Refactored TranslationBaseModelAdmin._patch_prepopulated_fields(). It now calculates "exclude" the same way ModelAdmin.get_form() does, including get_readonly_fields(). 2012-11-18 20:51:22 +01:00
Dirk Eschler
516d004837 Removed save_model override from admin which applied rule3. 2012-11-12 15:34:13 +01:00
Dirk Eschler
08a9683ae1 Switched to flake8 in favour of pep8 and pyflakes which allows to ignore certain statements. 2012-11-01 20:05:17 +01:00
Dirk Eschler
80c12b7177 Silenced pyflakes for required but unused import statement. 2012-11-01 19:58:07 +01:00
Dirk Eschler
ef3a065c6e Restored workaround for issue #19. 2012-11-01 19:48:52 +01:00
Dirk Eschler
3acfa09dbc - Validated codebase against pep8 and pyflakes.
- Fixed an undefined name bug in add_localized_fields error message when a model already has a field by the name that is added.
- Fixed redefined method name in ModeltranslationWithFileFields test class.
2012-10-24 11:06:35 +02:00
Dirk Eschler
9d58478b2e Fixed tabs don't properly support two-part language codes. Resolves issue 63. 2012-10-19 13:32:33 +02:00
Dirk Eschler
ea1e3426e7 Added workaround for issue 33: Using a non default language admin leads to confusing original field values. Done by forcing the default language in save_model. 2012-07-12 09:03:12 +00:00
Dirk Eschler
74b7feaeff Removed stale models.py import. 2012-07-10 14:59:24 +00:00
Dirk Eschler
75b7a27a94 Some cleanups. 2012-07-08 18:47:35 +00:00
Dirk Eschler
52401c3a9e Moved patch_prepopulated_fields to TranslationBaseModelAdmin as prepopulated_fields option is also available for inlines. Minor code cleanups. 2012-07-07 21:42:12 +00:00
Dirk Eschler
59c637ba36 More work on the admin integration refactoring. The exclude_languages isn't really thread safe, removed it for now. Handled custom model form fields and exclude options. 2012-07-06 15:49:26 +00:00
Dirk Eschler
6f7704bc57 Some cleanups and validated codebase against PEP8 and coding guidelines. 2012-07-04 10:09:22 +00:00
Dirk Eschler
1c8e82890d Major refactoring of the admin integration. Subclassed BaseModelAdmin and InlineModelAdmin. Patching options in init doesn't seem to be thread safe. Instead used provided hooks like get_form, get_formset and get_fieldsets. This should resolve several problems with the exclude and fieldsets options and properly support options in inlines. Added a new admin option exclude_languages to exclude certain translation fields per admin class. Moved tests to separate folder and added tests for TranslationAdmin. To run the tests the settings provided in model.tests.modeltranslation have to be used (settings.LANGUAGES override doesn't work for TranslationAdmin). 2012-07-04 09:29:05 +00:00
Dirk Eschler
babf186512 Fixed widgets for translated fields are not properly copied from original fields (thanks to boris-chervenkov). Resolves issue 74. 2012-05-10 08:33:57 +00:00
Dirk Eschler
1476e5483b Removed fix for grouped fieldsets committed in r124 because of a regression. This means grouped fieldsets are currently unsupported. 2012-02-23 09:53:56 +00:00
Dirk Eschler
9ed4b2167e Reverted r123 as this leads to problems with inlines. 2011-10-10 19:53:33 +00:00
Dirk Eschler
f2fd2eef59 Fixed grouped fieldsets translation is not displayed. Resolves issue 52. 2011-10-10 18:48:16 +00:00
Dirk Eschler
6055a1daec Fixed tabs don't properly support two-part language codes. Resolves issue 63. 2011-10-10 18:13:20 +00:00
Dirk Eschler
39262a8a02 Fixed a bug in the admin integration where an emptied default language field (which has been defined with "blank=True") hasn't cleared the default field. Resolves issue 47. 2011-04-10 20:27:24 +00:00
Dirk Eschler
4b4a322bca Ensured dict names are unique on a model-app-fieldname basis. 2010-09-29 10:19:40 +00:00
Dirk Eschler
8c0c3eec4a Added potential fix for "field is required" validation error on original field even if the default language field is set. 2010-09-10 10:47:42 +00:00
Dirk Eschler
1b0a5d14f9 FIXED: Optional default language fields don't get the correct css class. 2010-08-03 18:10:08 +00:00