On 09/19/2013 11:15 AM, John Gordon wrote:
In <mailman.154.1379606716.18130.python-l...@python.org> Gary Roach 
<gary719_li...@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







-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to