I have a two formsets rendered in a view called ContactIndex, the parent model for this view is the CustomUser model. I want to present the first_name of the user object in my html template. I've tried these tags without success any advise?
This is the tags in my HTML template:
{{ customuser.first_name }}
- does not work
{{ object.first_name }}
- does not work
This is my view:
def ContactIndex(request, CustomUser_id): customuser = CustomUser.objects.get(pk=CustomUser_id) if request.method == "POST": ContactFormset = ContactInlineFormSet(request.POST, request.FILES, instance=customuser) AddressFormset = AddressInlineFormSet(request.POST, request.FILES, instance=customuser) if ContactFormset.is_valid() or AddressFormset.is_valid(): AddressFormset.save() ContactFormset.save() # Do something. Should generally end with a redirect. For example: return redirect ('ContactIndex', CustomUser_id=customuser.id) else: ContactFormset = ContactInlineFormSet(instance=customuser) AddressFormset = AddressInlineFormSet(instance=customuser) return render(request, 'members/member_contact_form.html', {'ContactFormset':ContactFormset, 'Address Formset':AddressFormset })
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/865ff205-9a1d-4f62-bbe4-d2d12da22374o%40googlegroups.com.
No comments:
Post a Comment