Wednesday 15 May 2013

forms - Django Admin Action using intermediate page -


I have a model with many fields. I only have some fields I want. Instead, instead of a super list, I have a little change list, then there are administration actions that can give predetermined subsets of fields.

The initial action takes me to the right page, but when I present this form gives me back whatever page specifies me, but does not update the field if needed. When I start it, I am fine with tearing it down. I think I really need to know, what to put in the action of the html = "html" to keep the recursive work properly?

I am using the Denggo 1.7. I have to cover many of my areas as a CIA thing since working in a very information safe area.

This is my admin.py

  class credential admin (Admin.ModelAdmin): field = ['reserved' R ',' reserved '] list_desplay = [' from reserve ' 'Reserved'] Category Reserved SafeformAdam (forms.form): Reserved = form. Protected (self, request, queryet): form = any plural = '' request 'submit' in the form. CF field (widget = form.txtieria, max_long = 50) reserved = forms.DateTimeField (widget = forms.DateTimeInput) def. POST: Form = self.reserveToFormAdmin (request.POST) in Form.fields f: print f print form.is_valid () Print form. Errors if form.is_valid (): reservetos = form.cleaned_data ['reserveto'] reserved bills = form.cleaned_data ['reserved by'] print "hello" count = 0 for query in the query group: plural = 's' self.message_user (Request, "Successfully secured% s cred% s: cred.reserveto = reservetos cred.reservedBy = reservedByss cred.save (), then count = 1 count + = 1."% (counting, plural)) returned HttpResponseRedirect ( Request.get_full_path (), c) if not form: form = self.reserveToFormAdmin (initial = {'_ selected_action': request.POST.getlist (admin.ACTION_CHECKBOX_NAME)} returning (request, 'administrator / reserveCreds.ht Ml ', {' creds': query group, 'form': form, 'path': request.get_full_path ()} reserveCred.short_description = "reserve this creds" action = [check_out_a_cred, check_in_a_cred, audit_creds, compareAudits, reserveCred]  

reserveCreds.html

  {% extends "admin / base_site.html"%} {% block content%} & lt; P & gt; How long and which department is the receiver credits: & lt; / P & gt; & Lt; Form action = "{{path}}" method = "post" & gt; {% Csrf_token%} {{form}} & lt; Input type = "submit" name = "submit" value = "submit" /> & Lt; Input type = "button" value = "cancel" /> & Lt; / Form & gt; & Lt; H2 & gt; Reserved: & lt; / H2 & gt; & Lt; Ul & gt; {Cred for%}%} & lt; Li & gt; {{Cred.userid}} & lt; / Li & gt; {% Endfor%} & lt; / Ul & gt; {% Endblock%}  


No comments:

Post a Comment