Skip to content

Commit

Permalink
Merge branch 'release/1.4' into develop
Browse files Browse the repository at this point in the history
* release/1.4:
  updates documentation
  • Loading branch information
saxix committed Feb 27, 2017
2 parents 7671c8c + 679d07b commit b1c2f65
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 6 deletions.
8 changes: 8 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
Release 1.4
===========
* document :ghissue:`112` Undocumented feature: merge_form
* document :ghissue:`108` merge doesn't account for many-to-many relationships
* document :ghissue:`95` Cannot merge models with subclassed ImageField: "file not sent" error
* document :ghissue:`85` merge doesn't work for models related with on_delete=Protect


Release 1.3
===========
* fixes :ghissue:`92` translations are not compiled in package
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ fullclean:
psql -c 'DROP DATABASE IF EXISTS test_adminactions;' -U postgres;


docs: mkbuilddir
docs: .mkbuilddir
mkdir -p ${BUILDDIR}/docs
sphinx-build -aE docs/source ${BUILDDIR}/docs
ifdef BROWSE
firefox ${BUILDDIR}/docs/index.html
open ${BUILDDIR}/docs/index.html
endif
8 changes: 8 additions & 0 deletions docs/source/actions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ but were create double by mistake.
This action allow you to selectively merge two records and move dependencies
from one record to the other one.


**Screenshots**

Step 1
Expand All @@ -291,3 +292,10 @@ Step 2

.. figure:: _static/merge_2.png



**Limitations/TODO**

- merge doesn't work for models related with ``on_delete=Protect`` (see :ghissue:`85`)
- ImageField is not supported (see :ghissue:`95`)
- ManyToManyField is not supported (see :ghissue:`108`)
37 changes: 34 additions & 3 deletions docs/source/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ Exports a queryset as csv from a queryset with the given fields.
merge
-----

.. seealso:: See :ref:`merge` action for addtional notes.


Merge 'other' into master.

`fields` is a list of fieldnames that must be readed from ``other`` to put into master.
Expand All @@ -119,20 +122,48 @@ Merge 'other' into master.



Custom validation
~~~~~~~~~~~~~~~~~

If you need to disable validation for some fields, it is possible to set parameter ``merge_form``
to a subclass of `:class:adminactions.merge.MergeForm` and change the validation there.

.. code-block:: python
class CompanyMergeForm(merge.MergeForm):
class Meta:
model = models.Company
fields = "__all__"
def full_clean(self):
super().full_clean()
if 'address_psc' in self._errors:
del self._errors['address_psc']
class CompanyAdmin(city_admin_mixin_generator(admin.ModelAdmin):
form = CompanyForm
merge_form = CompanyMergeForm
.. _get_export_as_csv_filename:
.. _get_export_as_fixture_filename:
.. _get_export_delete_tree_filename:
.. _filename_callbacks:
-------------------
------------------
Filename callbacks
-------------------
------------------
To use custom names for yours exports simply implements ``get_export_<TYPE>_filename``
in your ``Modeladmin`` class, these must return a string that will be used as filename
in the SaveAs dialog box of the browser
example::
example:
.. code-block:: python
class UserAdmin(ModelAdmin):
def get_export_as_csv_filename(request, queryset):
if 'isadmin' in request.GET
Expand Down
2 changes: 1 addition & 1 deletion src/adminactions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import os
import subprocess

VERSION = __version__ = (1, 3, 0, 'final', 0)
VERSION = __version__ = (1, 4, 0, 'final', 0)
NAME = 'django-adminactions'


Expand Down

0 comments on commit b1c2f65

Please sign in to comment.