Code Monkey home page Code Monkey logo

django-adminactions's People

Contributors

axsapronov avatar bugman80 avatar domdinicola avatar gitter-badger avatar hanfeisun avatar int-ua avatar ipmb avatar kingbuzzman avatar kommusoft avatar maisim avatar mitchelljkotler avatar mrc75 avatar olivierdalang avatar pauloxnet avatar petrdlouhy avatar petrkudy avatar rafaelpivato avatar rvoicilas avatar sax-os4d avatar saxix avatar scrck avatar srugano avatar tdruez avatar ticosax avatar timgates42 avatar timthelion avatar trepmag avatar viatoriche avatar wolph avatar xangmuve avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

django-adminactions's Issues

exported Foreign-Key fields show an error instead of value

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()

pip installs version 1.0, but I can't see it here

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

Repeat stale content type warning

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

Mass update: add support for ManyToManyField using a "through" relation

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.

merge doesn't work

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

PyPI package does not match the documentation

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?

Merge function for `multiple merge`

Currently merge action only support merging two objects. It would be great if multiple object can be merged into one within one merge action.

Send a signal following a mass update

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.

howto build package

@saxix What are your steps build the package ?

What do you think about add "package" rule to Makefile to

  • copy src to build
  • compile translations files has mentionned in #92
  • other stuffs?

translations are not compiled in package

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?

Trying to use it with django-taggit: AttributeError 'Tag' object has no attribute 'somemodel_set'

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.

Django 1.8 Warning / Django 1.9 Deprecation for SortedDict

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

Do not export dates as strings in Excel

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

Provide a way to extend/customize the actions code...

... 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.

Merge function for related models

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..

massupdate : grappelli's autocomplete widget doesn't work

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 !

default of csv is not csv

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

Merge action, related and m2m

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

Improve graphs

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.

export_as_xls

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

CSV Export generate an UnicodeEncodeError if verbose_name use non ascii characters

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:

'ascii' codec can't encode character u'\xe8' in position 25: ordinal not in range(128), HTTP response headers must be in US-ASCII format

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.

Export Action Not Using Queryset

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:

  1. 600 model instances, admin showing 100 at a time.
  2. Click checkbox to select all items.
  3. Click link at top of list of 'select all 600 items'.
  4. Choose CSV Export Action.
  5. 600 items are exported.

Current Behavior:

  1. 600 model instances, admin showing 100 at a time.
  2. Click checkbox to select all items.
  3. Click link at top of list of 'select all 600 items'.
  4. Choose CSV Export Action.
  5. 100 items are exported.

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

BarChart doesn't show the data

in line 92 of 'graph.py' it says :

table = [[10, 20]]

well, it's obviously just for testing. it should say this :

table = [data]

Textarea are not disabled in the mass update

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

Separate Install from Test requirements

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?

Displayed labels for the field function are 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.

Tag new verison

Can you tag new version of adminaction and upload it to pypi.

Thanks

merge doesn't work for models related with on_delete=Protect

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 !!

Merge failing on DateTimeField with null=True

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'

Add support for custom fields

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?

Export not working when actions enabled on top & bottom

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

mass_update : redirect view_history instead of change

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

Permission problem

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?

Cannot merge models with subclassed ImageField or FileField: "file not sent" error

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.

Permissions don't work

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 !

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.