Git Product home page Git Product logo

django-object-actions's Introduction

Django Object Actions

CI

If you've ever tried making admin object tools you may have thought, "why can't this be as easy as making Django Admin Actions?" Well now they can be.

Quick-Start Guide

Install Django Object Actions:

$ pip install django-object-actions

Add django_object_actions to your INSTALLED_APPS so Django can find our templates.

In your admin.py:

from django_object_actions import DjangoObjectActions, action

class ArticleAdmin(DjangoObjectActions, admin.ModelAdmin):
    @action(label="Publish", description="Submit this article") # optional
    def publish_this(self, request, obj):
        publish_obj(obj)

    change_actions = ('publish_this', )
    changelist_actions = ('...', )

Usage

Defining new &tool actions is just like defining regular admin actions. The major difference is the functions for django-object-actions will take an object instance instead of a queryset (see Re-using Admin Actions below).

Tool actions are exposed by putting them in a change_actions attribute in your admin.ModelAdmin. You can also add tool actions to the main changelist views too. There, you'll get a queryset like a regular admin action:

from django_object_actions import DjangoObjectActions

class MyModelAdmin(DjangoObjectActions, admin.ModelAdmin):
    @action(
        label="This will be the label of the button",  # optional
        description="This will be the tooltip of the button" # optional
    )
    def toolfunc(self, request, obj):
        pass

    def make_published(modeladmin, request, queryset):
        queryset.update(status='p')

    change_actions = ('toolfunc', )
    changelist_actions = ('make_published', )

Just like admin actions, you can send a message with self.message_user. Normally, you would do something to the object and return to the same url, but if you return a HttpResponse, it will follow it (hey, just like admin actions!).

If your admin modifies get_urls, change_view, or changelist_view, you'll need to take extra care because django-object-actions uses them too.

Re-using Admin Actions

If you would like a preexisting admin action to also be an object action, add the takes_instance_or_queryset decorator to convert object instances into a queryset and pass querysets:

from django_object_actions import DjangoObjectActions, takes_instance_or_queryset

class RobotAdmin(DjangoObjectActions, admin.ModelAdmin):
    # ... snip ...

    @takes_instance_or_queryset
    def tighten_lug_nuts(self, request, queryset):
        queryset.update(lugnuts=F('lugnuts') - 1)

    change_actions = ['tighten_lug_nuts']
    actions = ['tighten_lug_nuts']

Customizing Object Actions

To give the action some a helpful title tooltip, you can use the action decorator and set the description argument.

@action(description="Increment the vote count by one")
def increment_vote(self, request, obj):
    obj.votes = obj.votes + 1
    obj.save()

Alternatively, you can also add a short_description attribute, similar to how admin actions work:

def increment_vote(self, request, obj):
    obj.votes = obj.votes + 1
    obj.save()
increment_vote.short_description = "Increment the vote count by one"

By default, Django Object Actions will guess what to label the button based on the name of the function. You can override this with a label attribute:

@action(label="Vote++")
def increment_vote(self, request, obj):
    obj.votes = obj.votes + 1
    obj.save()

or

def increment_vote(self, request, obj):
    obj.votes = obj.votes + 1
    obj.save()
increment_vote.label = "Vote++"

If you need even more control, you can add arbitrary attributes to the buttons by adding a Django widget style attrs attribute:

@action(attrs = {'class': 'addlink'})
def increment_vote(self, request, obj):
    obj.votes = obj.votes + 1
    obj.save()

or

def increment_vote(self, request, obj):
    obj.votes = obj.votes + 1
    obj.save()
increment_vote.attrs = {
    'class': 'addlink',
}

Programmatically Disabling Actions

You can programmatically disable registered actions by defining your own custom get_change_actions() method. In this example, certain actions only apply to certain object states (e.g. You should not be able to close an company account if the account is already closed):

def get_change_actions(self, request, object_id, form_url):
    actions = super(PollAdmin, self).get_change_actions(request, object_id, form_url)
    actions = list(actions)
    if not request.user.is_superuser:
        return []

    obj = self.model.objects.get(pk=object_id)
    if obj.question.endswith('?'):
        actions.remove('question_mark')

    return actions

The same is true for changelist actions with get_changelist_actions.

Alternate Installation

You don't have to add this to INSTALLED_APPS, all you need to to do is copy the template django_object_actions/change_form.html some place Django's template loader will find it.

If you don't intend to use the template customizations at all, don't add django_object_actions to your INSTALLED_APPS at all and use BaseDjangoObjectActions instead of DjangoObjectActions.

More Examples

Making an action that links off-site:

def external_link(self, request, obj):
    from django.http import HttpResponseRedirect
    return HttpResponseRedirect(f'https://example.com/{obj.id}')

Limitations

  1. django-object-actions expects functions to be methods of the model admin. While Django gives you a lot more options for their admin actions.
  2. If you provide your own custom change_form.html, you'll also need to manually copy in the relevant bits of our change form .
  3. Security. This has been written with the assumption that everyone in the Django admin belongs there. Permissions should be enforced in your own actions irregardless of what this provides. Better default security is planned for the future.

Python and Django compatibility

See ci.yml for which Python and Django versions this supports.

Demo Admin & Docker images

You can try the demo admin against several versions of Django with these Docker images: https://hub.docker.com/r/crccheck/django-object-actions/tags

This runs the example Django project in ./example_project based on the "polls" tutorial. admin.py demos what you can do with this app.

Development

Getting started:

# get a copy of the code
git clone [email protected]:crccheck/django-object-actions.git
cd django-object-actions
# Install requirements
make install
make test  # run test suite
make quickstart  # runs 'make resetdb' and some extra steps

Various helpers are available as make commands. Type make help and view the Makefile to see what other things you can do.

Some commands assume you are in the virtualenv. If you see "ModuleNotFoundError"s, try running poetry shell first.

Similar Packages

If you want an actions menu for each row of your changelist, check out Django Admin Row Actions.

Django Object Actions is very similar to django-object-tools, but does not require messing with your urls.py, does not do anything special with permissions, and uses the same patterns as making admin actions.

django-object-actions's People

Contributors

actions-user avatar alexerson avatar alexriina avatar amareis avatar andybak avatar aramgutang avatar bashu avatar browniebroke avatar coagulant avatar crccheck avatar danmoz avatar dlo avatar ilyachch avatar jamesshannon avatar jgillard avatar jimfunk avatar maestrofjp avatar mathiasertl avatar mgrdcm avatar mschfh avatar ron8mcr avatar sir-sigurd avatar wolph 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  avatar  avatar  avatar

django-object-actions's Issues

Incompatibility with django-reversion

Whenever this ModelAdmin mixin is enabled (depending on the order) either the action buttons for this project or the buttons for django-reversion don't show up.

I think creating a custom change_list.html template might do the trick, but is there an easy/official way to take care of this?

POST actions

Have there been any thoughts about converting actions to POST requests rather than GET?

I found https://github.com/texastribune/django-object-actions/pull/2but it appears that's mostly on the serving side and not where the buttons are produced.

However, almost by definition an "action" should be initiated with a POST rather than a GET, both for semantics and security. Is there an easy way to do this? Any reasons not to?

James

typing support

Hi!
How to make library friends with mypy?
For example if I use code from readme

class MyModelAdmin(DjangoObjectActions, admin.ModelAdmin):
    def toolfunc(self, request: HttpRequest, obj: MyModel) -> None:
        pass
    toolfunc.label = "This will be the label of the button"
    toolfunc.short_description = "This will be the tooltip of the button"

I catch this error from mypy:

"Callable[[MyModelAdmin, HttpRequest, MyModel], None]" has no attribute "label"
"Callable[[MyModelAdmin, HttpRequest, MyModel], None]" has no attribute "short_description"

For example for django admin short_description and etc. I use django-admin-display. How do you look at adding something like this to your project?

Latest version not available in pypi

Hello, latest version available in change log is not available to pypi I guess something broke or the script that pushes it there doesn't work

Page not found in Django 1.9 with simple action

class TaskAdmin(DjangoObjectActions, admin.ModelAdmin):
    def cancel(self, request, task):
        task.cancel()
    objectactions = 'cancel',

Go to admin page, press 'CANCEL' button and...

task object with primary key '2/change/tools/cancel' does not exist.

Page URL is

task/2/change/tools/cancel/change/

But if manually change URL to

2/tools/cancel

All is OK.

I found what in https://docs.djangoproject.com/en/1.9/releases/1.9/#django-contrib-admin
The URL of the admin change view has been changed (was at /admin/<app>/<model>/<pk>/ by default and is now at /admin/<app>/<model>/<pk>/change/). This should not affect your application unless you have hardcoded admin URLs. In that case, replace those links by reversing admin URLs instead. Note that the old URL still redirects to the new one for backwards compatibility, but it may be removed in a future version.

Document _row_actions field in the Readme.md

Hi, it would be lovely if you mention that you can override '_row_actions' field, by inserting it whenever needed in the list_display field of the Admin model class. So that people won't need to read the code to figure that out :).

Thanks,

Using values from the admin screen form in an action

My use case requires that I modify one of the fields in the admin form, and then invoke an action. Basically, I need a function signature like that of ModelAdmin.save_model, which gives me access to the form in addition to the object. Using a POST (as discussed in #16) to do so seems like a workaround, but I'm not sure how to do that either. Any words of wisdom?

Filtered querset for changelist_actions

The queryset passed to changelist_actions includes all objects, even if the admin view has an active filter/search.
Is there a way to receive a queryset identical to the filtered list that the admin view is currently using?

Instead of getting only the checked objects, I receive query with all the entities in the table

Hello guys,
Is it possible to use the check boxes in the admin UI to filter only the objects that I would like to take place in the queryset, sent to my function? I red the documentation of the package couple of times but couldn't realize how to achieve this. For the moment, it doesn't matter if I have checked something, none or all, I am getting full list of all the objects in the table. It's a great package, though, thank you for sharing it with us :) 💯

Supporting a wider range of actions types

I've been improving Django Admin Row Actions recently and I wanted to reuse the row actions as object actions.

Row Actions supports a few things that Object actions doesn't:

  1. Passing in just a link
  2. Methods on the model as well as the modeladmin
  3. Passing in lambdas or wrapped methods such as partials (useful for dynamically generating actions

Would you be interested in any of the above for Object Actions? I'll clean up the code a touch more if so.

Removing QuerySetIsh removes a feature

I was updating to 0.6.0 and it broke due to the missing QuerySetIsh class. It might not be an obvious use case, but I am using QuerySetIsh with isinstance to determine if an action was called from the change list view or from the change form view. Now it seems to be impossible to find out how the action was called.

Ability to place action buttons within fields

Hi,
let me start by expressing my gratitude for your efforts into this nice project !

When actions are related to a certain field, it makes sense to have their button rendered within that field.
See for instance:
Reset_password_example
("Mot de passe" meaning "Password" in French).

I've managed to make the "Reset password" button appear in the password field by dedicating the help_text to it:

class UserChangeForm(admin_forms.UserChangeForm):
    class Meta(admin_forms.UserChangeForm.Meta):
        model = User

    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        password = self.fields.get('password')
        if password:
            password.help_text = \
                """<ul class="object-tools"><li class="objectaction-item" data-tool-name="reset_password">
                <a href="/admin/users/guest/3/actions/reset_password/" title="" class="">Reset password</a>
                </li></ul>
                """

Very hacky, but it hopefully provides you with a useful starting point for implementing this feature, would you consider it.

Cheers

500 on prefixing pk with "%20" in URL

Lets say you have a model "model" inside the app "app" with object actions enabled and available for this model. Lets also assume, object app.model with pk=13 exists in the DB.

Calling http://localhost:8000/admin/app/model/13/ works.

Calling the detail view like this http://localhost:8000/admin/app/model/%20%2013/ results in an uncaught 500 (NoReverseMatch). The reason should be, that django allows blanks in its admin urls for the pk variable and the django-object-actions URLs don't.

NoReverseMatch exception thrown for custom primary keys

If you attempt to attach DjangoObjectActions to a model that has a primary key that is neither hex nor decimal, a NoReverseMatch exception is thrown.

The problem is this code in _get_action_urls():

            # change, supports pks that are numbers or uuids
            url(r'^(?P<pk>[0-9a-f\-]+)/actions/(?P<tool>\w+)/$',

This seems arbitrary, considering that we're creating a new custom URL space and all primary keys have to be already URL-compatible.

I fixed my use case by relaxing the pattern:

            url(r'^(?P<pk>[\w\\-]+)/actions/(?P<tool>\w+)/$',

...which doesn't appear to have any negative consequences.

Recommendation:

  1. Relax the regex; or

  2. Provide a mechanism to easily override the default assumptions about primary key regex; or

  3. Make it easier to add extra urls to the results of this function. I tried to create a subclass that appended another URL pattern to the results of super(DjangoObjectActions, self)._get_action_urls() but I needed a bunch of context that's created within that method, so it was just easier to copy the entire method into the subclass and change the regex.

Use custom admin `list_display` field.

I think need use list_display without template usage.

class Admin(DjangoObjectActions, ...):
    list_display = ( ... , 'object_actions')

class DjangoObjectActions(...)
   def object_actions(self, obj):
       for x in objectactions:
           ...
       return "HTML WITH BUTTONS"

   object_actions.allow_tags = True

It is may be more simple, and not require work with templates. What do you think about it?

And it is fix grappelli issuse, and all issuse connected to custom templates.

django-object-actions not compatible with django-import-export

Has anyone ever tried to use django object actions together with django import export?

I have a admin class that I would like to use both of these together:

class MyClass(DjangoObjectActions, ImportExportMixin, SimpleHistoryAdmin):

Like this, I can see my django object actions, but none of the Django import export actions in the admin.
When I change to this:

class MyClass(ImportExportMixin, DjangoObjectActions, SimpleHistoryAdmin):

I see my import export buttons but none of my django object actions anymore.

Button URL

Hi guys,
Quick question and sorry if it's a bit noobish...

But how do I set the button's url?

For example I want the button to be brought to admin/print/schedule.html

Thanks,
Ara

404 for actions returned by get_object_actions() but not in objectactions

Currently if an admin view overrides get_object_actions() and returns an action not contained in the objectactions view's attr, then invoking the action from the admin interface results in a 404.

This occurs because BaseDjangoObjectActions. get_tool_urls uses self. objectactions, not self.get_object_actions().

It seems this might be unavoidable, but is unexpected since it's not documented, and annoying if you're trying to create a base/mixin admin view class that use get_object_actions() to provide actions in addition to subclasses that provide their own.

id error on primary key field

This type of model fields fails with id does not exist error:

class Poll(TimeStampedModel):
id = models.CharField(max_length=256, primary_key=True)

The problem is primary key field, it return route to unicode id value and display id does not exist error.

Django 2 plans

With Django 2 on the horizon, the plan is to release what I got as v1, trying to get as many of these naming things issues #44 out of the way as possible.

django-object-actions will have a v2 release for Django 2 with no backwards compatibility. The v1 release will get basic patches, time permitting

NoReverseMatch when "save_as = True" enabled

With an admin model

class MyModelAdmin(DjangoObjectActions, admin.ModelAdmin):
    save_as = True
    change_actions = ('my_action')

I'm getting following error when I click Save as new button (highlighting line # 7).

NoReverseMatch at /admin/myapp/mymodel/1/change/

Error during template rendering

In template /Users/dacodekid/.envs/myapp/lib/python3.5/site-packages/django_object_actions/templates/django_object_actions/change_form.html, error at line 7
Reverse for 'myapp_mymodel_actions' with arguments '()' and keyword arguments '{'tool': 'my_action', 'pk': None}' not found. 2 pattern(s) tried: ['admin/myapp/mymodel/actions/(?P<tool>\\w+)/$', 'admin/myapp/mymodel/(?P<pk>[0-9a-f\\-]+)/actions/(?P<tool>\\w+)/$']
1   {% extends "admin/change_form.html" %}
2   
3   
4   {% block object-tools-items %}
5     {% for tool in objectactions %}
6       <li class="objectaction-item" data-tool-name="{{ tool.name }}">
7         <a href='{% url tools_view_name pk=object_id tool=tool.name %}' title="{{ tool.standard_attrs.title }}"
8            {% for k, v in tool.custom_attrs.items %}
9              {{ k }}="{{ v }}"
10           {% endfor %}
11           class="{{ tool.standard_attrs.class }}">
12        {{ tool.label|capfirst }}
13        </a>
14      </li>
15    {% endfor %}
16    {{ block.super }}
17  {% endblock %}

Drop Python 2.6 support

Django 1.7 drops Python 2.6 support. If we drop Django 1.6 support, we can definitely drop Python 2.6.

Schedule: drop Python 2.6 test coverage, then start breaking things

Enhancement in the documentation

I think it's worth mentioning that for old-style classes the order in which we declare the multiple inheritance on the ModelAdmin is important.

More specifically, writing

class MyModelAdmin(admin.ModelAdmin, DjangoObjectActions):
     # your ModelAdmin

won't work because of the depth-first, left-to-right rule whereas

class MyModelAdmin(DjangoObjectActions, admin.ModelAdmin):
     # your ModelAdmin

will work as expected.

So just one sentence in the README might save some time for those trying to use django-object-actions.

By the way thanks a lot for this application, it's really handy.

0.6 has breaking changes.

Reverting to <0.6 fixes it. Perhaps django-object-actions is expecting all URLpatterns to have a name, when that is not a valid assumption?

ERROR: myproject.plugins.text.tests:TextPluginTests.test_render
  subl myproject/plugins/text/tests.py:90   # test_render
    response = self.app.get(self.page_1.get_absolute_url(), user=self.staff_1)
  subl /Users/tailee/.virtualenvs/myproject/src/django-fluent-pages/fluent_pages/models/db.py:154  # get_absolute_url
    return self.default_url
  subl /Users/tailee/.virtualenvs/myproject/src/django-fluent-pages/fluent_pages/models/db.py:170  # default_url
    root = reverse('fluent-page').rstrip('/')
  subl /Users/tailee/.virtualenvs/myproject/lib/python2.7/site-packages/django/core/urlresolvers.py:551  # reverse
    return iri_to_uri(resolver._reverse_with_prefix(view, prefix, *args, **kwargs))
  subl /Users/tailee/.virtualenvs/myproject/lib/python2.7/site-packages/django/core/urlresolvers.py:415  # _reverse_with_prefix
    self._populate()
  subl /Users/tailee/.virtualenvs/myproject/lib/python2.7/site-packages/django/core/urlresolvers.py:269  # _populate
    for pattern in reversed(self.url_patterns):
  subl /Users/tailee/.virtualenvs/myproject/lib/python2.7/site-packages/django/core/urlresolvers.py:372  # url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  subl /Users/tailee/.virtualenvs/myproject/lib/python2.7/site-packages/django/core/urlresolvers.py:366  # urlconf_module
    self._urlconf_module = import_module(self.urlconf_name)
  subl /Users/tailee/.pyenv/versions/2.7.10/lib/python2.7/importlib/__init__.py:37   # import_module
    __import__(name)
  subl djangosite/urls.py:35   # <module>
    url(r'^kiosk/', include(admin.site.urls)),
  subl /Users/tailee/.virtualenvs/myproject/lib/python2.7/site-packages/django/contrib/admin/sites.py:262  # urls
    return self.get_urls(), self.app_name, self.name
  subl /Users/tailee/.virtualenvs/myproject/lib/python2.7/site-packages/django/contrib/admin/sites.py:246  # get_urls
    url(r'^%s/%s/' % (model._meta.app_label, model._meta.model_name), include(model_admin.urls))
  subl /Users/tailee/.virtualenvs/myproject/lib/python2.7/site-packages/django/contrib/admin/options.py:598  # urls
    return self.get_urls()
  subl /Users/tailee/.virtualenvs/myproject/src/django-eventkit/eventkit/admin.py:115  # get_urls
    urls = super(EventAdmin, self).get_urls()
  subl /Users/tailee/.virtualenvs/myproject/lib/python2.7/site-packages/polymorphic/admin.py:319  # get_urls
    dummy_urls += admin.get_urls()
  subl myproject/events/admin.py:90   # get_urls
    urls = super(myprojectEventsAdminMixin, self).get_urls()
  subl /Users/tailee/.virtualenvs/myproject/lib/python2.7/site-packages/django_object_actions/utils.py:50   # get_urls
    return self.get_tool_urls(urls) + urls
  subl /Users/tailee/.virtualenvs/myproject/lib/python2.7/site-packages/django_object_actions/utils.py:26   # get_tool_urls
    if url_pattern.name.endswith(end):
AttributeError: 'NoneType' object has no attribute 'endswith'

Add label/description decorator for "cleaner" code

Perhaps it's something that only irks me, but I find that this syntax quickly becomes readable after the function goes beyond a few lines:

   def publish_this(self, request, obj):
       publish_obj(obj)
   publish_this.label = "Publish"  # optional
   publish_this.short_description = "Submit this article"  # optional

I'm currently using this little decorator to take care of the labels and description which works great:

def create_action(label=None, short_description=None):

    def _create_action(function):
        if label:
            function.label = label

        if short_description:
            function.short_description = short_description

        return function

    return _create_action

Usage is like this:

    @create_action('Publish', 'Submit this article')
    def publish_this(self, request, obj):
        publish_obj(obj)

django-mezzanine template.

For those who use mezzanine cms the template should look like belowe, because it use grappelli:

{% extends "admin/change_form.html" %}
{% load i18n future %}

{% block object-tools %}
{% if change %}
{% if not is_popup %}


{% endif %}
{% endif %}

BTW, there should be also a template for admin/change_list.html if we want to have additional action for all items or eg. when we want to have import functionality.

Better POST support

add a way to say "hey, this action should only take POST". If set, is rendered as a form submit instead of a link.

Open in new tab

Hi,

I looked everywhere for this but coudn't find it... but how do you make that a link is opened in a new tab?

Thanks,
Ara

404 on Django 1.7.1

I have implemented the DOA library exactly as indicated in the example, and am getting a 404 with the following detail:

(model) object with primary key u'0b637de8-ae8a-4fe6-8558-369e9eed2c34/tools/mark_reject' does not exist.

As you can see, i'm using a UUID as my primary key. Might this be a factor? How would you recommend me debugging it? I've gone into the source code and I'm afraid I'm not skilled enough to follow what's happening...

Thanks! Would love for this to work, it would be a lifesaver...

Object action not showing in admin change form

Thanks for creating this useful package. I followed the setup process however the actions are not showing in admin.

I'm using Python 3.5, Django 1.9.2 and Flat Admin Theme.

This is my implementation:

@admin.register(Entry)
class ProcedureEntryAdmin(DjangoObjectActions, admin.ModelAdmin):
    # ...

    def publish_this(self, request, obj):
        obj.publish()

    publish_this.label = "Publish"
    change_actions = ['publish_this' ]

Thanks!

`changelist_actions` doesn't execute related method in 1.1.0

I tried to setup changelist_action but found that related method is not executed. One can reproduce that using demo app version with docker (1.9 and 2.0) and click on DELETE_ALL button in Choices model. "just kidding!" message is not showed. It works fine in 1.0.0.

Naming things

I could have sworn I had a naming things issue before. I'm not that happy with some of the name choices I made.

  • INSTALLED_APPS name: django_object_actions stays the same
  • main admin mixin: DjangoObjectActions
  • admin mixin w/o template: BaseDjangoObjectActions
  • model admin attribute: objectactions ➡️ change_actions ?
  • decorator: takes_instance_or_queryset ➡️ to_queryset ?
  • template context variable: objectactions ➡️ ?
  • docs: "tools" ➡️ "change actions", "action tools"

This is really the only thing blocking a 1.0 release

model admin attribute, objectactions

The scope of the project is expanding a bit. The Django admin has conventions for standard admin views. The docs show there's the:

  • add view
  • change view
  • changelist view
  • delete view
  • history view

Each of those could potentially have their own sets of actions. If we re-use the existing names, we end up with add_actions, change_actions, changelist_actions, delete_actions, and history_actions.

template context variable: objectactions

For every view, it'd be nice to have the same context variable. We don't need to differentiate between each kind.

Preserve List Filters

Is there a way to redirect an user after he clicked on an action and preserve applied filters?

Any help would be appreciated :)

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.