Hi All:

First off, apologies if this message ends up appearing twice - I had a 
minor problem getting Google to recognise that I'd subscribed...

For my first 'teach myself Django' project, I'm implementing an 
application to manage a software repository. Programs in the repository 
have a category (office, internet, multimedia, etc, etc) associated with 
them and a changelog is maintained showing which items were added to, 
deleted from or changed in each subsequent release of the repository.

I've worked through the tutorials and read some of the online book. I 
have my models defined and the admin interface for my application works 
pretty much the way I want it.

The models look like this:

-----begin models.py-----
from django.db import models

categoryChoices = (
     (1, 'Security'),
     (2, 'Office'),
     (3, 'Programming'),
     (4, 'Internet'),
     (5, 'Multimedia'),
     (6, 'Miscellaneous'),
)

# Create your models here.
class Program(models.Model):

     ratingChoices = (
         (1, 'Essential'),
         (2, 'Important'),
         (3, 'Nice to Have'),
         (4, 'Geeks Only'),
     )

     category = models.IntegerField(choices = categoryChoices)
     rating = models.IntegerField(choices = ratingChoices)
     name = models.CharField(max_length = 50)
     version = models.CharField(max_length = 15)
     description = models.TextField()
     mainURL = models.URLField(verify_exists = False)
     downloadURL = models.URLField(verify_exists = False)
     installerPath = models.FileField(upload_to = 'downloads')

     def __unicode__(self):
         return str(self.name) + ' v' + str(self.version)

class Release(models.Model):
     version = models.CharField(max_length = 15)
     reldate = models.DateField()

     def __unicode__(self):
         return 'v' + str(self.version) + ' (' + str(self.reldate) + ')'

class ChangeLog(models.Model):
     relVersion = models.ForeignKey('Release')
     category = models.IntegerField(choices = categoryChoices)
     logEntry = models.CharField(max_length = 100)

------end models.py------

My admin interface looks like this:

-----begin admin.py-----
from django.contrib import admin
from winxpUtils.software.models import Program, Release, ChangeLog

class ProgramAdmin(admin.ModelAdmin):
     list_display = ('name', 'version', 'category', 'rating')
     ordering = ('name',)
     list_filter = ('category', 'rating')
     search_fields = ('description',)

class ChangeInline(admin.TabularInline):
     model = ChangeLog
     extra = 3

class ReleaseAdmin(admin.ModelAdmin):
     list_display = ('version', 'reldate')
     ordering = ('-version',)
     inlines = [ChangeInline]

class ChangeLogAdmin(admin.ModelAdmin):
     list_display = ('relVersion', 'category', 'logEntry')
     ordering = ('category',)
     list_filter = ('relVersion',)

admin.site.register(Program, ProgramAdmin)
admin.site.register(Release, ReleaseAdmin)
admin.site.register(ChangeLog, ChangeLogAdmin)

------end admin.py------

The only thing that I can't figure out in the admin interface is how to 
make my 'TabularInline' bit display the way I want it to. When I go to 
the 'Releases' page, every ChangeLog entry has the title 'ChangeLog 
object' displayed above it. Is there any way to get rid of this? The 
'polls' application in the tutorial doesn't have object names displaying 
like this, but I can't see what I'm doing differently. Just in case my 
explanation isn't clear, I've put a partial screen shot here:

http://www.linux2000.com/django-admin.png

The titles I want to get rid of are circled. Hope this makes sense and 
thanks in advance for any suggestions.

-- 

Regards

Phil Edwards   |  PGP/GnuPG Key Id
Brighton, UK   |  0x68393AEE


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to