python - What is the recommended approach to implement admin-actions-alike functionality outside admin? -
i've been searching way reproduce admin-actions behavior on own tables using django-tables2. haven't found module introduce functionality listview derive , looking @ modeladmin see there many methods implied on this. of course, can add form around table checkboxes , submit button pointing view works ids i'm looging combo choose among different actions in django-admin have 'actions' meta option list methods possible actions perform. found django-actions still young introduces it's own page operations , need integrate functionality on own model can connect input type=select model actions. comment appreciated :)
there no built-in solution it. have implement actions in views , functionality templates.
add, edit , delete operations easy implement in views.py
. depends on models, can trigger database manipulations within templates , keep logic in views.py
.
you can add form templates described in docs:
# forms.py django.forms import modelform myapp.models import article # create form class. class articleform(modelform): class meta: model = article fields = ['pub_date', 'headline', 'content', 'reporter']
model
:= choose model want modify / add
fields
:= select fields model, want show in form
this defines form corresponding model, can used in templates modify or add entity database.
Comments
Post a Comment