Hey, based on your name I believe u speak our language, so will switch to
that : )

Ako hoces da na primer supplier_name bude automatski popunjeno kao koristik
samo dodaj ovako u views.py:
view:
def performance_view(request):
form = PerformanceForm({'supplier_name':request.user})
if form.is_valid():
form.save()
return render(request, 'qif/performance.html', {"form" : form})

уто, 15. јан 2019. у 09:51 Ivan Martić <martic.i...@gmail.com> је
написао/ла:

> Hi all,
>
> can someone assist me.
> I cant get the modelform field get populated with active username.
>
> Does any one have a good advice?
>
> view:
> def performance_view(request):
> form = PerformanceForm(request.POST or None)
> if form.is_valid():
> form.save()
> return render(request, 'qif/performance.html', {"form" : form})
>
> forms:
> from django import forms
> from .models import Performance
>
>
> class PerformanceForm(forms.ModelForm):
> class Meta:
> model = Performance
> fields = [
> 'supplier_name',
> 'deliverability',
> 'rating',
> 'rated_by',
> 'date_of_entry'
> ]
>
> def __init__(self, rated_by, *args, **kwargs):
> super(PerformanceForm, self).__init__(*args, **kwargs)
> self.fields["rated_by"].initial = rated_by
>
> what am i missing..
> Thank you in advance..
>
> --
> 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+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/df4ca182-fb48-4a27-a2a0-a9b20f0e6a21%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/df4ca182-fb48-4a27-a2a0-a9b20f0e6a21%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAJ60hW2jg6rAeHtX-dW8KJj3dVK5DRsYDWCT0f0eh9-tJKqTBQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to