Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #54435

Re: django admin.py error

Date 2013-09-19 11:49 -0700
From Gary Roach <gary719_list1@verizon.net>
Subject Re: django admin.py error
References <mailman.154.1379606716.18130.python-list@python.org> <l1fev6$k1v$1@reader1.panix.com>
Newsgroups comp.lang.python
Message-ID <mailman.157.1379616572.18130.python-list@python.org> (permalink)

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

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







Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

django admin.py error Gary Roach <gary719_list1@verizon.net> - 2013-09-19 09:04 -0700
  Re: django admin.py error John Gordon <gordon@panix.com> - 2013-09-19 18:15 +0000
    Re: django admin.py error Gary Roach <gary719_list1@verizon.net> - 2013-09-19 11:49 -0700
      Re: django admin.py error John Gordon <gordon@panix.com> - 2013-09-19 18:56 +0000
        Re: django admin.py error (solved) Gary Roach <gary719_list1@verizon.net> - 2013-09-19 12:33 -0700

csiph-web