Monday, April 27, 2020

Re: AttributeError

Do you have a "date" field in your models.py.? Please share models.py, and views.py as well


On Mon, 27 Apr 2020 at 22:44, Phako Perez
<13.phakman@gmail.com> wrote:
I think issue is how you are trying to access the attribute
This is a form and must be accessed through a post call.

Can you share your html form???

Sent from my iPhone

On 27 Apr 2020, at 10:29, DimGo <proskuryakov931@gmail.com> wrote:


from django import forms
from django.core.exceptions import ValidationError

class SearchProduct(forms.Form):
 text
=forms.CharField(label='Search ')
 date
=forms.DateField(required=False)
 
t
= SearchProduct()
print(t.date)

Error:

AttributeError: 'SearchProduct' object has no attribute 'date'



why is there this error? How to fix it?

ff

--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/445e0ffb-03e7-4a32-9d83-b48795a9866c%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+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/6FEB0B14-73FF-4A74-80B4-ED982F95D01F%40gmail.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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/37640327.684638.1588012361686%40mail.yahoo.com.

No comments:

Post a Comment