Re: AttributeError with forms

2020-04-27 Thread 'Amitesh Sahay' via Django users
I couldn't open the screenshot . But to work with the django forms you need to 
perform below tasks.
1) create model of your choice in models.py.2).  Python manage.py 
makemigrations3) python manage py migrate.4 create a python file called 
forms.py inside your app.5) import your models there ( from .models import 
model_name6) create class to extend forms module.7) in views.py you either need 
to define class based views or function based views. 
I hope that helps.

Sent from Yahoo Mail on Android 
 
  On Mon, 27 Apr 2020 at 20:59, DimGo wrote:   Why 
is this this strange error? 


-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7a2089af-344a-479d-bf7c-8a943973159b%40googlegroups.com.
  

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/407015029.685337.1588012209457%40mail.yahoo.com.


Re: AttributeError with forms

2020-04-27 Thread Ethem Güner
It's not strange. You can't access to an attribute of a form class
directly. Remember how do you define the form in a view. You're passing
arguments such as *data=request.POST*. You're trying to access an undefined
attribute. Because It's a form class and needs input.

Try to print *t.__dict__  *you'll get a dictionary of that class. But If
you really need to access to the attribute like this, use* t['date']*

DimGo , 27 Nis 2020 Pzt, 18:29 tarihinde şunu
yazdı:

> Why is this this strange error?
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/7a2089af-344a-479d-bf7c-8a943973159b%40googlegroups.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAMsyPm_ck-hhC-P_FGz3vwk_fgKQWAy9rx6WpAh7AE1Gr08iqg%40mail.gmail.com.


Re: AttributeError with forms

2020-04-27 Thread Phako Perez
In addition, you must define your model in models.py

And to get this attributes on your views.py from a post request, you could use 
like {{ form.attribute }}

Regards

Sent from my iPhone

> On 27 Apr 2020, at 10:29, DimGo  wrote:
> 
> 
> Why is this this strange error? 
> -- 
> 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 view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/7a2089af-344a-479d-bf7c-8a943973159b%40googlegroups.com.
> <Снимок экрана от 2020-04-27 18-06-28.png>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/A6EAD9A6-59B3-4986-8338-DF0A5DFDF2F7%40gmail.com.