Bok Nebojsa,

hvala ti na brzom odgovoru.
napravio sam ovako i nema promjene....

def performance_view(request):
* form = PerformanceForm(request.POST or None,
{'supplier_name':request.user})*
if form.is_valid():
form.save()
messages.success(request, 'Your entry has been saved. Relevant persons will
be informed of this change.')
#(nevezano za populate) i ovaj message.success mi se isto  javlja kao
problem.. na performance appu mi bilježi login/logout umjesto samo poruka
nakon uspješnog spremanja.
return render(request, 'qif/performance.html', {"form" : form})

Možda mi nešto na formi nedostaje?

uto, 15. sij 2019. u 11:59 Nebojsa Hajdukovic <nebojsa.zero...@gmail.com>
napisao je:

> 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
> <https://groups.google.com/d/msgid/django-users/CAJ60hW2jg6rAeHtX-dW8KJj3dVK5DRsYDWCT0f0eh9-tJKqTBQ%40mail.gmail.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/CAFab_C_iOye2LahEJxOArPPqyEaqEFcM_H%2B2MrDeRXHbTaYGYw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to