12👍
I think in forms.py you are using
from django.forms import forms
Please use this
from django import forms
- "TemplateSyntaxError Invalid block tag: 'trans'" error in Django Templates
- Django no csrftoken in cookie
- How to give initial value in modelform
- How do I register a model that is already registered in admin?
- Logging formatters in django
- Tastypie Negation Filter
- Django – Rendering Inclusion Tag from a View
- Django: Filter for get_foo_display in a Queryset
- Is there a way to generate pdf containing non-ascii symbols with pisa from django template?
1👍
This :
question = models.CharField(max_length=200)
Instead of :
question = models.Charfield(max_length=200)
- Return Custom 404 Error when resource not found in Django Rest Framework
- Is it possible to run automatically celery at startup?
0👍
I have the same error but following code works for me:
from django.db import models
#Create your models here.
class Question(models.Model):
question_text = models.CharField(max_length=100)
pub_date = models.DateTimeField('date published')
class Choice(models.Model):
choice_text = models.CharField(max_length = 200)
votes = models.IntegerField(default =0)
question = models.ForeignKey(Question, on_delete=models.CASCADE)
Simply change charfield() to charField() ..
0👍
In model Poll
, spelling of CharField
is not properly formatted. Ie you have written a small letter f
inplace of a capital letter F
. So, replace Charfield
by CharField
. You can see the code below:
from django.db import models
class Poll(models.Model):
question = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published') class Choice(models.Model):
poll = models.ForeignKey(Poll)
choice = models.CharField(max_length=200)
votes = models.IntegerField()
- Celery task and customize decorator
- Redirect request to admin interface
- HttpResponse vs. Render
- Selenium.common.exceptions.InvalidCookieDomainException: Message: invalid cookie domain while executing tests in Django with Selenium
- Django sekizai {% addtoblock %} tag is not working properly
- Django: How to save original filename in FileField?
Source:stackexchange.com