view: def performance_view(request): form = PerformanceForm( {'supplier_name':request.user} ) if request.method == "POST": form = PerformanceForm[request.POST] if form.is_valid(): form.save() return render(request, 'qif/performance.html', {"form" : form})
ovako nekako bi trebalo da radi уто, 15. јан 2019. у 12:49 Ivan Martić <martic.i...@gmail.com> је написао/ла: > Ej hvala ti, puno mi je jasnije.. razumijem da si u gužvi, idem dalje sam > pa ako zapnem javim se... > > 5 Star for support!! > > uto, 15. sij 2019. u 12:45 Nebojsa Hajdukovic <nebojsa.zero...@gmail.com> > napisao je: > >> moras da dodas >> if request.method == "POST" >> form = PerformanceForm[request.POST] >> izvini sad sam u nekoj bas velikoj guzvi, evo ti otprilike kako sam ja na >> drugoj formi uradio, ako ne uspes ispisacu ti malo kasnije >> [image: image.png] >> >> уто, 15. јан 2019. у 12:26 Ivan Martić <martic.i...@gmail.com> је >> написао/ла: >> >>> Bravo! radi! >>> Samo što sad neradi spremanje (request.POST)...kako da to sad >>> implementiram, jel može savjet? >>> >>> uto, 15. sij 2019. u 12:22 Nebojsa Hajdukovic <nebojsa.zero...@gmail.com> >>> napisao je: >>> >>>> Obrisi ovo request.post or none >>>> >>>> uto, 15. jan 2019. 12:19 Ivan Martić <martic.i...@gmail.com> je >>>> napisao/la: >>>> >>>>> 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 >>>>> <https://groups.google.com/d/msgid/django-users/CAFab_C_iOye2LahEJxOArPPqyEaqEFcM_H%2B2MrDeRXHbTaYGYw%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/CAJ60hW1YE0uihXQ%3DqC0mJ%2Btsy50Yo9n91GA2gFCz6HzEoq2bWA%40mail.gmail.com >>>> <https://groups.google.com/d/msgid/django-users/CAJ60hW1YE0uihXQ%3DqC0mJ%2Btsy50Yo9n91GA2gFCz6HzEoq2bWA%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_C93rOKN3z06cvbY3p4mA4-wogT4drfhGX69Nru2bUt5dQ%40mail.gmail.com >>> <https://groups.google.com/d/msgid/django-users/CAFab_C93rOKN3z06cvbY3p4mA4-wogT4drfhGX69Nru2bUt5dQ%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/CAJ60hW2BVvps7oYTJhT7%2B6-Dsv%2BR1Xheg72yjxXv9_ap8z4RTg%40mail.gmail.com >> <https://groups.google.com/d/msgid/django-users/CAJ60hW2BVvps7oYTJhT7%2B6-Dsv%2BR1Xheg72yjxXv9_ap8z4RTg%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_C948EAkmJKVAoEQQ67QWqFvfOUWzf6djqVGTRy5B217vw%40mail.gmail.com > <https://groups.google.com/d/msgid/django-users/CAFab_C948EAkmJKVAoEQQ67QWqFvfOUWzf6djqVGTRy5B217vw%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/CAJ60hW0FNxYsMoL1zxZCHCabiXH9t%2BLWibYMPBKWzR6WwUQcjQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.