Commit graph

131 commits

Author SHA1 Message Date
David Cooper
0f88fe83fa Use extra_context view kwarg in changelist_view()
Currently the `extra_context` kwarg is not used in `changelist_view`, it
is completely ignored. However, using it is a common idiom in a
`ModelAdmin` view method as a way to provide extra context variables to
an overridden template.

This is useful if one wants extra context variables in an overridden
`admin/constance/change_list.html` template.
2025-10-07 11:23:04 -04:00
Rémy Hubscher
6d01cffbc0
Use double quotes 2025-10-07 11:26:18 +02:00
Pascal Fouque
2ae381e58e
Fix is_composite_pk on Django 5.2 (#608) 2025-01-27 14:12:47 +05:00
Alexandr Artemyev
8c6552fdaf
Enable more rules for ruff (#562) 2024-07-05 19:38:26 +05:00
Alexandr Artemyev
57083bbed2
Add ruff format & lint (isort only) (#560) 2024-07-03 19:21:33 +05:00
Rotzbua
5f262fce9a
fix: django 5.1 removed collapse.js (#556) 2024-06-15 00:55:01 +05:00
Rotzbua
eb5aef2554
chore: migrate to f-string
fix: use str() instead of f-string

credit: tool pyupgrade
Co-Authored-By: Alexandr Artemyev <mogost@gmail.com>
2024-06-09 21:07:07 +02:00
Rotzbua
7589b11cf4
fix: remove legacy django <1.9 code 2024-06-08 23:28:12 +02:00
James Tiplady
6a5052e9f4
Adding support for using a subdirectory of MEDIA_ROOT for file fields (#475)
* Adding support for using a subdirectory of MEDIA_ROOT for file fields with CONSTANCE_FILE_ROOT setting

* Improving documentation for CONSTANCE_FILE_ROOT

* Updating PR branch to work with latest master
2023-07-29 11:35:38 -05:00
Søren Howe Gersager
0047a781af
Fix constance management command without admin installed (#506)
* refactor out ConstanceForm and get_values into forms.py and utils.py respectively

* fix tests and documentation

* correct mock import

* fix merge
2023-04-07 08:16:39 -05:00
Sergei Iurchenko
5ab48e1943
505-race-condition-caused-by-when-constance-registers-django-checks (#514)
Co-authored-by: Iurchenko Sergei
2023-03-13 17:45:31 -05:00
Dmitry
b6f8e2c5b8
"failed to update live settings" message (#491)
* "failed to update live settings" message

* Update constance/locale/ru/LC_MESSAGES/django.po

* test fix

* fix .po/.mo

Co-authored-by: Alexandr Artemyev <mogost@gmail.com>
2022-10-13 12:16:31 -05:00
Felippe Medeiros
b7da81451e
Forward the request when saving the form (#499) 2022-10-12 19:07:49 -05:00
alexkiro
55aed5d4d4
Add support for using gettext in fieldset headers (#489)
* Support tuples for CONFIG_FIELDSETS

* Add test for tuple CONFIG_FIELDSETS

* Preserve tuple fieldset sorting

* Add i18n example in the docs
2022-07-13 10:01:25 -05:00
Yurchenko Sergey
fc6d41fdb3
serialize_according_to_widget (#472)
Co-authored-by: Сергей Юрченко <s.yurchenko@softpro.com>
2022-02-11 19:49:08 -06:00
Jannis Leidel
53ac3cd45f
Add concrete_model class attribute to fake admin model. (#441)
* Add concrete_model class attribute to fake admin model.

This is related to #244 and https://github.com/django-admin-tools/django-admin-tools/issues/103.

* Set attribute during init.
2021-01-13 14:45:37 -05:00
Jair Henrique
08a20c1bbe
Use gettext_lazy instead of ugettext_lazy (#421)
Co-authored-by: Camilo Nova <camilo.nova@gmail.com>
2020-11-18 11:14:05 -05:00
Ekin Ertaç
dfce4f2fe5
url() is deprecated in Django 3.1 (#418)
* replace url()'s with re_path()

* convert re_path to path

* import path instead of re_path

* Convert missed re_path to path

Co-authored-by: Alexandr Artemyev <mogost@gmail.com>
2020-11-18 11:12:27 -05:00
Alexandr Artemyev
96bd3e1047
Fix #396 2020-05-25 19:24:54 +03:00
Erik Seglem
731514c52f
Switch md5 to sha256. (#395) 2020-05-20 08:28:50 -05:00
Sébastien Corbin
1de764a22c
Read-only form with correct perm (#393) 2020-04-29 12:02:04 -05:00
Ilya Chichak
4de4114bbd
Make groups of fieldsets collapsable. Fix #350 (#351)
* made results table responsive for Django 2 admin

* make fieldsets collapsable

* updated version via feature

* fixed codestyle according to requested changes

* made results table responsive for Django 2 admin

Co-authored-by: Camilo Nova <camilo.nova@axiacore.com>
2020-03-16 11:33:19 -05:00
Alexandr Artemyev
590fa02eb3 Drop support py<3.5 django<2.2 (#359)
* Drop support py<3.5 django<2.2

* Remove admin_static
2019-12-23 16:20:41 -05:00
Alexandr Artemyev
e069ddb91a
Fix #341 2019-09-16 11:51:18 +03:00
Dmitriy Tatarkin
299b3b1996 Fixed "can't compare offset-naive and offset-aware datetimes" (#337)
* Fixed "can't compare offset-naive and offset-aware datetimes" when USE_TZ = True

* Fixed case when `USE_TZ = False`
2019-08-12 11:00:07 -05:00
riazanovslv
98800c0671 ConstanceForm save method tweak (#333)
We need to store the actual name of the file, which the storage's save method provides. Otherwise, if we upload a new file with the same name as the already stored file has, the Constance config will keep a link to the old file.
2019-07-19 13:25:33 -05:00
Richard Morrison
2948dff3cc Add a Django system check... (#326)
* Add a Django system check that CONFIG_FIELDSETS accounts for all of CONFIG

* Fix test (don't actually modify values when submitting form) and restore python2 compatibility
2019-04-06 09:13:55 -05:00
Marc-Antoine Lemieux
a31d6f195f Use default_storage to save file (#319) 2019-03-13 19:11:25 -05:00
horida
286edca505 show not existing fields in field_list (#309) 2018-10-11 12:18:39 -05:00
Dmitry Karamin
45da6edd28 fix(admin): date type 2018-04-16 21:41:18 +03:00
Si Feng
1bec11477f Fix CONSTANCE_CONFIG_FIELDSETS mismatch issue 2018-03-13 16:56:00 -07:00
Anton Shurashov
40188c093a add config labels 2018-03-06 23:41:53 +03:00
Vladislav Manchev
b37b73bf0e
Fix ConstanceForm validation
Account for cases where CONSTANCE_CONFIG_FIELDSETS is not set at all in ConstanceForm validation.
2018-02-25 14:27:54 +01:00
Camilo Nova
29f493f7c1 Merge branch 'file-upload' 2017-11-08 08:42:34 -05:00
Manatsawin Hanmongkolchai
bbc7db2edc Merge https://github.com/jazzband/django-constance 2017-11-07 21:45:04 +07:00
Manatsawin Hanmongkolchai
6015e9c360 results_list: Move inline JavaScript to constance.js
Merge branch 'default-datetime' of https://github.com/rvernica/django-constance
2017-11-07 21:43:47 +07:00
Camilo Nova
7da7598291
Merge pull request #222 from JoshLabs/vb_validation_fix
Fixed #201
2017-11-06 11:47:22 -05:00
Camilo Nova
23e8557c83 Added file uploads. Fixes #141 and #241 2017-11-06 11:31:00 -05:00
Varun Bargali
d80acd0dc6 updated message files 2017-06-13 19:41:38 +05:30
Varun Bargali
d3da1e14bd added validation error for forgetting variables in CONSTANCE_CONFIG_FIELDSETS 2017-06-13 19:37:39 +05:30
Martin Pauly
3f5fc73409 Use admin_site property of ModelAdmin, to make sure that the correct list of apps is used 2017-06-02 23:27:20 +02:00
Bruno Alla
1cce582edc Fix #187: Preserve sorting from fieldset config (#207) 2017-06-02 10:52:16 +02:00
Jon Dufresne
3a1f8a898b Remove unnecessary calls to dict.keys
iter(dict) is equivalent to iter(dict.keys()). Can simply act on the
dict instead. Provides a more concise, Pythonic syntax and avoids an
unnecessary function call.

Inspired by Lennart Regebro's presentation "Prehistoric Patterns in
Python" at PyCon 2017. Available at:

https://www.youtube.com/watch?v=V5-JH23Vk0I
2017-06-02 10:23:21 +02:00
Camilo Nova
4268ea808a Merge pull request #213 from felixxm/cleanup-unused
Removed unused variables and imports.
2017-05-25 14:38:42 -05:00
Mariusz Felisiak
3af72e167b
Removed unused variables and imports. 2017-05-25 14:02:52 +02:00
Mariusz Felisiak
fc5a32f2ac
Fixed #211 -- Added datetime.timedelta support. 2017-05-25 13:50:27 +02:00
Martin Pépin
be65f6536a Add a get_changelist_form hook in the ModelAdmin
This method is used in the `changelist_view` to get the changelist form.

You may want to override this method to get a different form depending
on the user that makes the request. For example:

  class MyConstanceAdmin(ConstanceAdmin):
      def get_changelist_form(self, request):
          if request.user.is_superuser:
              return SuperuserForm:
          else:
            return super(MyConstanceAdmin, self).get_changelist_form(request)
2017-02-14 02:15:39 +01:00
Rares Vernica (cessna, fedora)
d308ccf601 Fix Reset to default for DateTime, #185 2017-01-19 10:55:48 -08:00
Rares Vernica
bddb6cd2ac Fix *Reset to default* to work with boolean/checkboxes (#191)
* Fix *Reset to default* to work with boolean/checkboxes

* Add field name to each config value
* Check field name and use *checked* for checkbox and *value* otherwise

Fix #189

* Add and use raw_default and is_checkbox
2017-01-13 08:14:18 +01:00
John Carter
e3ea904116 Backport command functonality from django-constance-cli (squashed) 2016-11-27 18:55:21 +13:00