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 302161
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T07:04:19+00:00 2026-05-12T07:04:19+00:00

I installed Django for the first time yesterday and trying it out in earnest

  • 0

I installed Django for the first time yesterday and trying it out in earnest today. I’m only planning to use it for the beautiful admin interface, Zend Framework for the rest.

I imported an existing table event into the admin. There’s no join needed. But the primary key is not ‘id’ it’s called “event” (following this naming convention). I obviously don’t want this column’s id# to appear in the data entry form.

Everything works fine, EXCEPT when adding a new event, I click Save and Continue Editing, it adds the event, but redirects the URL to
http://127.0.0.1:8000/admin/events/event/None/
and spits out this error

ValueError at /admin/events/event/None/

invalid literal for int() with base 10: 'None'

This is my models.py:

from django.db import models

class Event(models.Model):
    event = models.IntegerField(primary_key=True)
    title = models.CharField(max_length=150)
    address_1 = models.CharField(max_length=150)
    url = models.URLField(max_length=500,verify_exists=False)
    start_date = models.DateField()
    end_date = models.DateField()
    ACTIVE_CHOICES = (
        (0, 'InActive'),
        (1, 'Active'),
    )
    active = models.CharField(max_length=1, default=1, choices=ACTIVE_CHOICES)
    def __unicode__(self):
        return self.title
    class Meta:
        db_table = u'event'

Any ideas what I’m doing wrong or how to fix this?

  • 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-12T07:04:20+00:00Added an answer on May 12, 2026 at 7:04 am

    You probably want the PK to be an AutoField instead of an IntegerField so Django will automatically fill it in for you. Otherwise you have to do it yourself in the save method or the admin interface:

    class Event(models.Model):
        event = models.AutoField(primary_key=True)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We installed the django toolbar yesterday on our remote server and have been trying
So I am trying to make Django running with mod-wsgi for the first time.
I just installed my django 1.5 app on ec2 and right now the /admin
I am trying to setup django with fastcgi on apache. Django is installed and
I installed Django1.4 on Win 7 with python3.2. But when I run django-admin.py startproject
I'm trying to create a database in my first Django project (called meu_blog). I've
i recently switched to mac. first and foremost i installed xampp. then for django-python-mysql
I'm using django-non rel for the first time. I already had a simple django
I am trying to set the Django Admin to display English. This is what
I am an experienced PHP programmer using Django for the first time, and I

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.