saxix / django-adminactions Goto Github PK
View Code? Open in Web Editor NEWcollection of useful django actions to use with ModelAdmin or AdminSite.
License: Other
collection of useful django actions to use with ModelAdmin or AdminSite.
License: Other
Translations are not whorking because mo files are missing in package.
$ pip install django-adminactions
$ find site-packages/adminactions/locale
site-packages/adminactions/locale
site-packages/adminactions/locale/es
site-packages/adminactions/locale/es/LC_MESSAGES
site-packages/adminactions/locale/es/LC_MESSAGES/django.po
site-packages/adminactions/locale/it
site-packages/adminactions/locale/it/LC_MESSAGES
site-packages/adminactions/locale/it/LC_MESSAGES/django.po
site-packages/adminactions/locale/en
site-packages/adminactions/locale/en/LC_MESSAGES
site-packages/adminactions/locale/en/LC_MESSAGES/django.po
Is that translations should not be already compiled in the package?
Using install_requires and tests_require in the setup.py
The current setup is painful as you need all the dependencies even if you do not need to run the tests.
Seems like the only install requirements are unicodecsv, xlwt and mock. Everything else is only needed for tests.
Would you consider this separation?
if you have a model with a foreign key to another model, when you export the first model, instead of a value for that foreign key field, you get an error like: Unexpected data type <class 'app.models.yourModel'> but it would be nice if it showed the unicode function of the model ( which you see in the actual admin page )
theres a quick fix : in line 93 of 'utils.py' you can add these lines if isinstance(value, models.Model) : return value.unicode()
Hi,
I would like to use mass_update in my project. I can use some others actions like graph, but mass_update (like export ones) is not working. I have done the same config as in demo project. In my virtualenv, the demo project is working well, but in my project i have this error :
django.core.urlresolvers.NoReverseMatch
NoReverseMatch: Reverse for 'myapp_mymodel_history' with arguments '(u'',)' and keyword arguments '{}' not found.
Could you have any idea where to search the mistake i have done ?
Thx
Matt
I'm use a custom fields on admin listing. Extension on exporting show only defined fields on models. Can you add a custom fields and queryset aggregation? Or it's doesn't possible?
On installation page http://django-adminactions.readthedocs.org/en/latest/install.html
The line:
1.First of all follow the instruction to install standard admin application,
has a broken link to standard admin page
Make graphics with the data of the aplication is a very powerfull tool, there are a lot of payment services to do that, and I think that improve that feature could be very nice.
Add the posibility of create dashboards by model/app/website and add graph to the dashboards.
Add unique url to share the graph.
etc.
Coud be very nice and powerfull.
Mass update works fine on ManyToManyField using implicit relation.
Although, it the "through" relation is explicitly declared, the following error is returned on form submit:
Cannot set values on a ManyToManyField which specifies an intermediary model.
Note that the display of the Mass update form is fine, you can properly multi-select the m2m values.
Do you think we could add support for this?
Thanks.
Hi !
When trying to merge objects that have are related with on_delete=Protect, the merge fails because of a ProtectedError
exception.
When doing a merge and choosing to move the relations, I think one expects that the relations are moved to the "master" before actually deleting the "other", so I don't think the protection should apply here.
Actually, from what I understood of the code, it's exactly what's happening.
Here's an easy hack: olivierdalang@9938d10
Not sure if there's no side-effect, I didn't think it through, and I didn't manage to find out how to write a test for this, since it would need to create custom models (with protected relations), hence no PR.
Thanks for the great work !!
Hi,
I play with django-adminactions and it's really a nice job, thanks!
However for an application with french translation, CSV Export raise a UnicodeEncodeError if verbose_name_plural use non ascii characters.
Django Version: 1.4.3
Exception Type: UnicodeEncodeError
Exception Value:
The problem is located at this line in export.py
:
filename = "%s.csv" % queryset.model.meta.verbose_name_plural.lower().replace(" ", "")
I fix it for my app by using a generic filename for exports.
It will be really nice to implement signals in the mass update feature.
A signal similar to https://docs.djangoproject.com/en/dev/ref/signals/#post-save, "post_mass_update" that will be sent after a successful update. It could include the QuerySet and the list of updated fields.
I'm planning to use this signal for my notification system, create LogEntry of the changes and start process like "index update" following a successful mass update.
Thanks.
Inside XLS Export Options, i cant export columns with the header marked. Language used was portuguese Brazil.
https://www.google.com/jsapi is what is used for the charts which is fine, unless the app runs in a place where external access is not possible.
do you think there could be a way to generate charts without a remote API? may be http://www.flotcharts.org or http://www.jqplot.com/ or http://g.raphaeljs.com/
Philippe
Hello! I've been using the CSV adminaction, and I've noticed that it isn't using the queryset passed in to the action to get the list of IDs on which to operate.
As a result, if you do want to export all of a model, and the admin paginator is only showing a subset of those, it will only export the current page worth of items, even if you click the 'select all xxx items' link.
Expected Behavior:
Current Behavior:
I'm not entirely clear I can give you a patch that would fix this, but I've done enough traces to be able to confirm that the queryset passed into the admin action contains all 600 objects, while the POST parameter in the request only contains the first 100...
Cheers!
Tim
The merge action simply doesn't work. All others work OK but the merge seems to bypass, nothing happens, no message at all.
I'm using adminactions 0.2.0 final, django 1.5, python 2.7.3 and grappelli
For example, model B
is a foreign key of model A
, and b1
and b2
are two instances of model B
. b1
is the foreign key of a1
, and b2
is the foriegn key of a2
.
When b1
and b2
are merged into b1
, it would be great if a1
and a2
will be modified to point to b1
..
I tried django-adminactions 0.3 with django 1.5.4 and the merge action works correctly but related and m2m objects were deleted.
I used api.merge function and it correctly merged two objects and moved related and m2m objects from other to master.
There's a way to correctly "move" related and m2m objects with the "merge" actions TTW ? In other case can you add this feature ?
Best Regards,
Paolo
Because MyISAM engine doesn't has transaction
and rollback
function, the merge
action is not available..
Hi
As soon as adminactions is added to INSTALLED_APPS, my manage.py migrate begins exhibiting this issue
The following content types are stale and need to be deleted:
auth | group_permissions
auth | user_groups
auth | user_user_permissions
This also occurs for the one ManyToMany field my App has.
I can see in the database, the content types are created when I run migrate, and are again deleted after I enter 'yes' to confirm delete of 'stale' content types.
pip installed adminactions 0.8.3, django 1.7.8, sqlite3 (but also occurs with sqlserver_ado)
Regards
When passing the unformatted value of a relational field, xlwt writes an error Unexpected data type <class ...>
into the cell. Export to CSV displays these values correctly, since it's passing the values through the smart_str
helper.
File "adminactions/merge.py", line 151, in merge
fixed_value = datetime(raw_value.year, raw_value.month, raw_value.day,
AttributeError: 'NoneType' object has no attribute 'year'
Hi !
When I run pip install django-adminactions
, I get Successfully installed django-adminactions-1.0
.
The thing is I can't find a tag or a branch for 1.0 here, so I'm not sure about what's happening, especially since seems some bugs aren't fixed in 1.0, like #79...
On the other hand, if I run pip install django-adminactions==0.8.5
to get the last version existing here, I get Invalid template library specified. ImportError raised when trying to load 'adminactions.templatetags.massupdate': No module named 'django.forms.util'
.
I'm under Django 1.9.
Thanks !
Olivier
Current PyPI version is not compatible with stable Django version 1.10. New PyPI release should be made for full Django compatibility.
I have some tag objects from django-taggit
and I added merge action to the admin. When I try to merge two tags it's throwing exceptions like this:
...
File "adminactions/merge.py", line 139, in merge
api.merge(master, other, fields=fields, commit=True, related=related)
File "adminactions/api.py", line 96, in merge
accessor = getattr(other, name)
AttributeError: 'Tag' object has no attribute 'somemodel_set'
where somemodel
is a model with TaggableManager
field through this mixin:
class TagModelMixin(models.Model):
tags = TaggableManager(verbose_name=_('tags'), blank=True)
class Meta:
abstract = True
Trying to figure out what to do to make it work, will appreciate any suggestions.
site-packages/adminactions/mass_update.py:75: RemovedInDjango19Warning: SortedDict is deprecated and will be removed in Django 1.9. self._dict[field_class] = SortedDict(self.COMMON + args)
Looks like SortedDict is going away soon, so it's probably something that should be refactored.
Cheers!
Tim
I have done a simple Contact model and I have installed adminaction on my application. But the research about permission for export csv are wrong.
Adminactions search adminaction.export instead of "adminaction_export_contact". So in file export.py in line 31 it returns false and doesn't permit the exportation.
The user has stuff fleg on true and superuser on false. And it has all permissions.
What I wrong?
This is the wording displayed for each field function label: "Type help() for interactive help, or help(object) for help about object."
This is caused by the usage of the 'help' keyword instead of the 'label' variable.
in line 92 of 'graph.py' it says :
table = [[10, 20]]
well, it's obviously just for testing. it should say this :
table = [data]
Hi !
When using grappelli's autocomplete feature for foreign keys, the widget doesn't work in massupdate.
It seems the javascript is loaded properly, but the URL to load the values in ajax is wrong :
http://127.0.0.1:8000/grappelli/lookup/autocomplete/?term=blablabla&app_label=false&model_name=false&query_string=false
instead of
http://127.0.0.1:8000/grappelli/lookup/autocomplete/?term=blablabla&app_label=BaseFoncier&model_name=ilot&query_string=_to_field=id
So the ajax query fails (500 error) and the widget is unusable.
It's as if the widget was properly rendered but didn't know about the context.
I tried to look at the source to see if it is an easy fix, but it's a bit over my skills.
Thanks !
Can you tag new version of adminaction and upload it to pypi.
Thanks
It would be great if you could specify something like:
list_mass_udpate_fields = ('field1','field2',)
in the admin model and have mass_update only show those fields available for mass _update.
... I'm interested in particular in the Mass Update feature.
See #20 and #21 for examples where the need for customization of the actions make sense.
It would be great to have a simple way to extend to current adminactions actions code in my codebase without having to copy the full source from adminactions and to add custom pieces, this goes against the DRY principle.
What about the Django suggested approach for complex action, ie putting the logic in a view and using the action as a redirect. See https://docs.djangoproject.com/en/1.5/ref/contrib/admin/actions/#actions-that-provide-intermediate-pages
Ideally, the action logic should be a class-based view (or simply a class, the view structure may be unnecessary), with a clean separation of the different step in the code workflow, in a Django spirit, to ease the extensibility of it.
I'm just throwing ideas, you may have a better way to handle this.
I'd like to know your opinion.
Thanks.
Following the install instructions I get the above error. Can anyone else confirm this is an issue?
In the mass update view, each input is disabled by default until you check the "update" checkbox. This works fine for the "input text", "select" etc.. but not for the textarea (ie TextField). It needs to be added in the massupdate.js
The default options passed to the csv writer doesn't actually output csv.
csv_options_default = {'date_format': 'd/m/Y',
'datetime_format': 'N j, Y, P',
'time_format': 'P',
'header': False,
'quotechar': '"',
'quoting': csv.QUOTE_ALL,
'delimiter': ';',
'escapechar': '\\', }
a delimiter of ';' is not csv, but semicolon-sv
I need to access the ModelAdmin instance in my receivers. What do you think about doing this change? The Model will always be accessible using the ModelAdmin in any case.
The export functionality does not work when enabling two action drop-downs in the admin site.
To reproduce:
In the admin file define:
admin.ModelAdmin.actions_on_top = True
admin.ModelAdmin.actions_on_bottom = True
Export functionality will fail.
This is because the action name isn't resolved properly from the request data.
In the adminactions export code:
'action': request.POST.get('action')
def base_export(modeladmin, request, queryset, title, impl, name, template, form_class, ):
...
initial = {'_selected_action': request.POST.getlist(helpers.ACTION_CHECKBOX_NAME),
'select_across': request.POST.get('select_across') == '1',
'action': request.POST.get('action'),
'columns': [x for x, v in cols]}
...
While in admin code:
def response_action(self, request, queryset):
...
'action': data.getlist('action')[action_index]
...
I hope this is clear enough
When I use mass update actions for one record the message says:
Updated 4 records
Currently merge action only support merging two objects. It would be great if multiple object can be merged into one within one merge action.
In the latest development version django crashes looking for settings.TESTING. Adding Testing = False to the settings file fixes this. I guess this was left over from the unit testing suite?
api has support for custom fields
should be able to do this via admin view also
header = [unicode(f.verbose_name) for f in queryset.model._meta.fields if f.name in fields]
is no good when the fields not in the original order, consider
header = [queryset.model._meta.get_field_by_name(f)[0].verbose_name for f in fields]
Please consider add a option for usedisplay=True during calling get_field_value in export_as_xls . Sometimes we want to get the display value rather than the raw value.
Thanks
Furen
I've followed the docs link from PyPI and it seems that it only applies to Git repository version of the library, and not the PyPI package. Could you please update the PyPI version?
Hi !
On my installation, permissions are not working.
For every user except the super user, I get a "Sorry you do not have rights to execute this action" message, even if the user or it's group have the permission.
For every user, I see all registered adminactions, even if the user has not the permission.
Django : 1.8.5
Django-adminaction : 0.8.5
Is this supposed to work ? If it's a bug (and not some mistake of my part), I'd be glad to give it a shot !
The tool is great, thanks a lot for the work !
Hi !
Here, when exporting datetime values to XLS, I get strings like oct. 8, 2015, 1:58 après-midi
or even oct. 21, 2015, midi
instead of date values.
I'm not really sure on how the xls exporter library works, but there must be a way to export the date as an excel date instead of a string ? The formatting of the date should be done as a style, not on the value of the cell.
I'm having a look right now, and will make a PR if there's an easy fix !
Bests,
Olivier
If a model that I want to merge have a field that is not an original ImageFIeld, but was subclassed from it, for example:
class ImageField2(ImageField):
pass
then default MergeForm stops working if resulting instance contains a link in this field. Is it a bug? Can I somehow subclass MergeForm to state which field needs to be just copied instead of trying to upload an image?
It's an old project with django-thumbs
, in case it can help.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.