Hello,
I'm building my first Django project and was wanting to know how to
add a <select> field type to the admin page. I would like the
Details.project_type field to be displayed as a select box but it's
not a foreign key, how do I go about this?
Thanks,
Jason
from django.db import models
class Project(models.Model):
client = models.CharField(max_length=30)
add_date = models.DateTimeField('date added')
class Meta:
ordering = ['-add_date']
def __unicode__(self):
return self.client
class Admin:
fields = (
('Client', {'fields': ('client',)}),
('Date Added', {'fields': ('add_date',)}),
)
pass
class Details(models.Model):
project = models.ForeignKey(Project)
project_type = models.CharField(max_length=30) # displayed as
<select>
title = models.CharField(max_length=50)
blurb = models.TextField()
builder = models.CharField(max_length=50)
photography = models.CharField(max_length=100)
interior_designer = models.CharField(max_length=50)
def __unicode__(self):
return self.title
class Image(models.Model):
name = models.CharField(max_length=30)
def __unicode__(self):
return self.name
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---