Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6217433
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T07:25:31+00:00 2026-05-24T07:25:31+00:00

Python 2.7 Django 1.3 When I include ‘user_id’,’user’ in the admin.py, then… no user

  • 0
  • Python 2.7
  • Django 1.3

When I include 'user_id','user' in the admin.py, then…

  • no user field shows up in the form when I click to add a Timeslip.
  • If I submit it anyway, then it shows the user field with a “This field is required.” error message.
  • If I pick a user & submit again, then I get “‘TimeslipAdmin.fields’ refers to field ‘user_id’ that is missing from the form.” even though ‘user_id’ is clearly listed in my admin.py (see below)

The Traceback says —

  • Exception Type: ImproperlyConfigured at /admin/timeslip/timeslip/add/
  • Exception Value: ‘TimeslipAdmin.fields’ refers to field ‘user_id’ that is missing from the form.

But…if I leave 'user_id','user' out of the admin.py then….

  • no user field shows up when I click to add a Timeslip.
  • Submit it anyway, and it shows the user field & a “Timeslip with this User already exists.” error message. (which shouldn’t be an error either ’cause I want users to have multiple Timeslip’s which means another error I’ll have to figure out once I can just get this form working)

admin.py

from timeslip.models import Timeslip
from django.contrib import admin

class TimeslipAdmin(admin.ModelAdmin):
    fields = ['user_id','user','day','hours_as_sec','part_of_day','drove','gas_money','notes']

admin.site.register(Timeslip, TimeslipAdmin)

models.py

from django.db import models
from django.contrib.auth.models import User

# Create your models here.

class Timeslip(models.Model):
   user=models.ForeignKey(User)
   day = models.DateField()
   hours_as_sec = models.PositiveIntegerField()
   part_of_day = models.CharField(max_length=16,choices=PART_O_DAY)
   drove = models.BooleanField(default=False)
   gas_money = models.DecimalField(max_digits=5,decimal_places=2)
   notes = models.TextField()

class UserProfile(models.Model):
   user = models.ForeignKey(User)
   url = models.URLField("Website", blank=True)
   position = models.CharField(max_length=50, blank=True)

User.profile = property(lambda u: UserProfile.objects.get_or_create(user=u)[0])

I’m very clueless how to overcome this. I’m coming from a PHP background, a newbie to Python & Django.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T07:25:32+00:00Added an answer on May 24, 2026 at 7:25 am

    user_id and user are redundant. Django automatically names your user field user_id in the database (since it holds the id for the User instance it points to.)

    Change your admin.py to the following and it should work:

    class TimeslipAdmin(admin.ModelAdmin):
        fields = ['user','day','hours_as_sec','part_of_day','drove','gas_money','notes']
    

    Also you’re including all of the fields in the admin, so you really don’t need to specify the fields. This would work just as well:

    class TimeslipAdmin(admin.ModelAdmin):
        pass
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on a web application using Python (Django) and would like to
I'm currently looking at the Python framework Django for future db-based web apps as
My current project is in Rails. Coming from a Symfony (PHP) and Django (Python)
This particular example relates to Django in Python, but should apply to any language
I'm using Django and Python 2.6, and I want to grow my application using
When starting a django application using python manage.py shell , I get an InteractiveConsole
(Django 1.x, Python 2.6.x) I have models to the tune of: class Animal(models.Model): pass
I'm learning Python now because of the Django framework. I have been a Perl
I have written a Django app that makes use of Python threading to create
I'm really new to Python and Django. I created a class in Python that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.