Django 0.96, OS X 10.4, MySQL 5.1, Python 2.4.2.
I'm using the automatic admin, and when I click on a column heading, I get a
traceback:
OperationalError at /admin/trips/leg/
(1054, "Unknown column 'trips_trip.-start_date' in 'order clause'")
The leg class has a foreign key to the trip class, and the trip class has
order_by defined as '-start_date' so that newer trips are at the top.
Any ideas how to fix this?
I'm appending the definitions (but will remove some of the fields in each
definition--they're very long):
class Trip(models.Model):
status = models.CharField(maxlength=20, choices=STATUS_CHOICES,
blank=True)
primary_fc = models.ForeignKey('FC', related_name='primary',
verbose_name="Primary FC")
backup_fc = models.ForeignKey('FC', verbose_name="Backup FC")
company = models.ForeignKey('Company')
tail = models.ForeignKey('Aircraft',)
trip_contact = models.ForeignKey('Contact')
start_date = models.DateField()
class Meta:
ordering = ['-start_date', 'company']
class Admin:
list_display = ['status', 'start_date', 'company', 'tail',
'primary_fc',]
list_filter = ['status', 'primary_fc', 'company']
search_fields = ['company']
save_on_top = True
...
class Leg(models.Model):
trip = models.ForeignKey('Trip')
flight_type = models.CharField(maxlength=25,
choices=FLIGHT_TYPE_CHOICES)
traveler = models.ManyToManyField('Traveler',
filter_interface=models.HORIZONTAL, blank=True)
dep = models.CharField(maxlength=4)
depdate = models.DateField()
deptime = models.TimeField()
arr = models.CharField(maxlength=4)
arrdate = models.DateField()
arrtime = models.TimeField()
class Meta:
ordering = ['depdate', 'deptime']
unique_together = (('trip', 'dep', 'depdate', 'deptime'),)
class Admin:
list_display = ('trip', 'dep', 'arr', 'depdate', 'deptime',)
list_filter = ['trip',]
search_fields = ['trip',]
I'll be grateful for any assistance you can provide.
Cheers!
--
David Hancock | [EMAIL PROTECTED]
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---