Oh I gotcha now.

Django model forms by default do not represent auto fields (ID's)
because it wouldn't make much sense for a user to be able to edit the
PK in a form. Having said that, I do understand why you need to be
able to see the PK.

I shown in my example, I personally prefer to represent the PK in the
url so something like

http://localhost/Partner/Edit/3 would be sent to the view:

def edit(request, id):

If you do not like doing it that way, you just have to pass the ID of
the partner object into your template. SInce you are saving your
partner object in session you can get access to it right away in the
template. Just alter your template a bit:


  <form method=...>
       <table>
         {{ form.as_Table}}
       </table>
       <input type="hidden" name="partner_id"
value="{{ request.session.partner.id}}" />
   </form>

Now you ahve Id available in your post data, so you can do your check.

if request.POST.get("partner_id"):
    continue processing
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to