You passed form to template, so you have to refer to that. On Tue, 9 Oct, 2018, 5:33 PM konstantin Heinrich, <[email protected]> wrote:
> I declared in views.py variable called frm so I have to use it > in my html file to have access to that file.? > > > > Am Di., 9. Okt. 2018 um 13:54 Uhr schrieb Joel <[email protected]>: > >> instead of <p>{{ frm }}</p>, try: >> >> <p>{{ form }}</p> >> >> I think you'll understand what you did wrong. >> >> On Tue, 9 Oct, 2018, 5:07 PM , <[email protected]> wrote: >> >>> hello, >>> >>> I've tried to create a simple CharField in a Form and show it in my >>> webbrowser >>> but I didn't see anything on my webbrowser? >>> >>> >>> Below my code: >>> >>> *forms.py* >>> from django import forms >>> >>> >>> >>> class menuForm(forms.Form): >>> image = forms.CharField(initial = 'Your Name') >>> date = forms.DateField() >>> >>> >>> >>> >>> >>> *urls.py* >>> from django.urls import path >>> from . import views >>> >>> urlpatterns = [ >>> path('', views.menu), >>> >>> ] >>> >>> *Views.py* >>> from django.shortcuts import render >>> from django.http import HttpResponse >>> from .forms import menuForm >>> >>> def menu(request): >>> frm = menuForm() >>> >>> return render(request, 'base.html', {' form ': frm} ) >>> >>> >>> >>> *html-file* >>> >>> <html lang="de"> >>> >>> <head> >>> <title> Menu</title> >>> >>> </head> >>> <body> >>> Hallo >>> <p>{{ frm }}</p> >>> >>> </body> >>> </html> >>> >>> I can only see "Hallo" on my webbrowser but no input for a CharField? >>> >>> Can anybody help? >>> >>> >>> -- >>> 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 [email protected]. >>> To post to this group, send email to [email protected]. >>> 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/abc9ba3c-1d3b-4d84-9915-16c4fc02a27e%40googlegroups.com >>> <https://groups.google.com/d/msgid/django-users/abc9ba3c-1d3b-4d84-9915-16c4fc02a27e%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 [email protected]. >> To post to this group, send email to [email protected]. >> 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/CAA%3Diw_9w2hC5sEUOyvWgC%2BPOysiptQTJizdVp1acS91dra_gHQ%40mail.gmail.com >> <https://groups.google.com/d/msgid/django-users/CAA%3Diw_9w2hC5sEUOyvWgC%2BPOysiptQTJizdVp1acS91dra_gHQ%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 [email protected]. > To post to this group, send email to [email protected]. > 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/CAHKy%2BPnYcLS8M3ZPp-G3gT%2BmYgaxo6z2U1jay3OvmpwKJ7UhQg%40mail.gmail.com > <https://groups.google.com/d/msgid/django-users/CAHKy%2BPnYcLS8M3ZPp-G3gT%2BmYgaxo6z2U1jay3OvmpwKJ7UhQg%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 [email protected]. To post to this group, send email to [email protected]. 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/CAA%3Diw_8afmPOAVW8Bo0nRz288XQx6ggbUghkpDer0zLaaH2JDg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.

