Note that there are some explanatory texts on larger screens.

plurals
  1. PO'PollAdmin.fields' refers to field 'None' that is missing from the form
    text
    copied!<p>I'm trying to make a poll with Django but I'm very new to it and when I go to the admin thing it gives this error:</p> <pre><code>ImproperlyConfigured at /admin/polls/poll/1/ 'PollAdmin.fields' refers to field 'None' that is missing from the form. </code></pre> <p>I'm not very sure what that means but this is my admin.py file which I think is causing the error:</p> <pre><code>from django.contrib import admin from polls.models import Poll class PollAdmin(admin.ModelAdmin): fields = [ (None, {'fields': ['question']}), ('Date information', {'fields': ['pub date']}), admin.site.register(Poll, PollAdmin) </code></pre> <p><strong>Edit</strong>:</p> <p>Here's my models file if that matters:</p> <pre><code>from django.db import models import datetime from django.utils import timezone class Poll(models.Model): question = models.CharField(max_length = 200) pub_date = models.DateTimeField('date published') def __unicode__(self): return self.question def was_published_recently(self): return self.pub_date &gt;= timezone.now() - datetime.timedelta(days = 1) class Choice(models.Model): poll = models.ForeignKey(Poll) choice_text = models.CharField(max_length = 200) votes = models.IntegerField() def __unicode__(self): return self.choice_text </code></pre> <p><strong>Edit (again)</strong></p> <p>Now I fixed my PollAdmin class to this:</p> <pre><code>class PollAdmin(admin.ModelAdmin): fieldsets = [ (None, {'fields': ['question']}), ('Date information', {'fields': ['pub_date']}), ] </code></pre> <p>But it's saying:</p> <pre><code>DoesNotExist at /admin/polls/poll/1/ Site matching query does not exist. </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload