Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin3!goblin1!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.023 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'subject:error': 0.03; 'error:': 0.07; 'django': 0.11; "'address'": 0.16; '__future__': 0.16; 'admin.py': 0.16; 'django.db': 0.16; 'fine.': 0.16; 'helps.': 0.16; 'importerror': 0.16; 'meta:': 0.16; 'received:206.46': 0.16; 'received:206.46.173': 0.16; 'subject:django': 0.16; 'wrote:': 0.18; 'import': 0.22; 'admin': 0.22; 'installation': 0.23; 'header:User-Agent:1': 0.23; 'define': 0.26; 'tried': 0.27; 'am,': 0.29; "skip:' 10": 0.31; 'file:': 0.31; 'gary': 0.31; 'writes:': 0.31; 'yes.': 0.31; 'class': 0.32; 'skip:m 30': 0.32; 'worked': 0.33; 'skip:d 20': 0.34; 'add': 0.35; 'thanks': 0.36; 'to:addr:python-list': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'skip:u 10': 0.60; 'hope': 0.61; 'skip:a 30': 0.61; 'john': 0.61; 'name': 0.63; 'field': 0.63; 'received:206': 0.63; 'city': 0.66; 'reply': 0.66; 'header:In- reply-to:1': 0.84; 'received:192.168.1.7': 0.84; 'died': 0.91 Date: Thu, 19 Sep 2013 11:49:14 -0700 From: Gary Roach User-Agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:17.0) Gecko/20130828 Icedove/17.0.8 MIME-version: 1.0 To: python-list@python.org Subject: Re: django admin.py error References: In-reply-to: Content-type: multipart/alternative; boundary=------------030802070603070400010002 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 157 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1379616572 news.xs4all.nl 15931 [2001:888:2000:d::a6]:56466 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:54435 This is a multi-part message in MIME format. --------------030802070603070400010002 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit On 09/19/2013 11:15 AM, John Gordon wrote: > In Gary Roach writes: > >> Installation of the django admin.py package worked fine. But. when I >> tried to add my database to the admin page I get the following error: > ImportError at /admin/ > Does /home/gary/ProgramFiles/mysite/mysite/models.py define an object > named 'membership'? > Yes. The following is the top part of the models.py file: q from __future__ import unicode_literals from django.db import models class Membership(models.Model): id_membership = models.IntegerField(unique=True, primary_key=True) first_name = models.CharField(max_length=20L, blank=True) middle_name = models.CharField(max_length=20L, blank=True) last_name = models.CharField(max_length=20L, blank=True) born = models.DateField(null=True, blank=True) born_date_accuracy = models.CharField(max_length=8L, blank=True) died = models.DateField(null=True, blank=True) died_date_accuracy = models.CharField(max_length=8L, blank=True) photo_url = models.CharField(max_length=200L, db_column='photo_URL', blank=True) # Field name made lowercase. class Meta: db_table = 'membership' class Address(models.Model): id_address = models.IntegerField(unique=True, primary_key=True) street = models.CharField(max_length=45L, blank=True) city = models.CharField(max_length=45L, blank=True) state = models.CharField(max_length=45L, blank=True) class Meta: db_table = 'address' class AddressHasMembership(models.Model): address_id_address = models.ForeignKey(Address, db_column='address_id_address') membership_id_membership = models.ForeignKey('Membership', db_column='membership_id_member ship') class Meta: db_table = 'address_has_membership' I hope this helps. Thanks for the reply Gary R --------------030802070603070400010002 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit
On 09/19/2013 11:15 AM, John Gordon wrote:
In <mailman.154.1379606716.18130.python-list@python.org> Gary Roach <gary719_list1@verizon.net> writes:

Installation of the django admin.py package worked fine. But. when I 
tried to add my database to the admin page I get the following error:
	ImportError at /admin/
 
Does /home/gary/ProgramFiles/mysite/mysite/models.py define an object
named 'membership'?

Yes. The following is the top part of the models.py file: q

from __future__ import unicode_literals

from django.db import models

class Membership(models.Model):
    id_membership = models.IntegerField(unique=True, primary_key=True)
    first_name = models.CharField(max_length=20L, blank=True)
    middle_name = models.CharField(max_length=20L, blank=True)
    last_name = models.CharField(max_length=20L, blank=True)
    born = models.DateField(null=True, blank=True)
    born_date_accuracy = models.CharField(max_length=8L, blank=True)
    died = models.DateField(null=True, blank=True)
    died_date_accuracy = models.CharField(max_length=8L, blank=True)
    photo_url = models.CharField(max_length=200L, db_column='photo_URL', blank=True) # Field name made lowercase.
    class Meta:
        db_table = 'membership'

class Address(models.Model):
    id_address = models.IntegerField(unique=True, primary_key=True)
    street = models.CharField(max_length=45L, blank=True)
    city = models.CharField(max_length=45L, blank=True)
    state = models.CharField(max_length=45L, blank=True)
    class Meta:
        db_table = 'address'

class AddressHasMembership(models.Model):
    address_id_address = models.ForeignKey(Address, db_column='address_id_address')
    membership_id_membership = models.ForeignKey('Membership', db_column='membership_id_member
ship')
    class Meta:
        db_table = 'address_has_membership'

I hope this helps. Thanks for the reply

Gary R







--------------030802070603070400010002--