Hello,
I'm trying to modify my admin.py from my app "ordis":

from ordis.models import Ordi, Maintenance, OperatingSystem
from django.contrib import admin

#class MaintenanceAdmin(admin.ModelAdmin):
        #list_display = (???) here I would like to see my Computer id, and
the OS installed on it

def renvoi_os(Ordi):
        #return ("%d" % (Ordi.id)).upper()
        return ("%d %d" % (Ordi.id, Ordi.operatingsystemused)).upper()
class MaintenanceAdmin(admin.ModelAdmin):
    list_display = (renvoi_os,)
#class OrdiAdmin(admin.ModelAdmin):


admin.site.register(Ordi)
admin.site.register(Maintenance,MaintenanceAdmin)
admin.site.register(OperatingSystem)

That admin.py is associated with this models.py:

from django.db import models

from django.db.models import (Model, BooleanField,
    CharField, DateTimeField, TextField, URLField,
    EmailField, ManyToManyField, ForeignKey, IntegerField,
    FileField, ImageField)

# Create your models here.

class OperatingSystem (models.Model):
        operatingsystem = CharField (max_length=30, blank=True, null=True)
class Ordi(models.Model):
        architecture = CharField (max_length=30, blank=True, null=True)
        operatingsystemused = ManyToManyField(OperatingSystem, null=True,
blank=True)
class Maintenance(models.Model):
        ordi=ForeignKey(Ordi, blank=True, null=True)
        action = TextField(null=True, blank=True)


When I just call Ordi.id in admin.py (commented line), I get the Ordi
id associated with "Maintenance".
But the line with Ordi.id + Ordi.operatingsystemused gives me back a
(None)

What am I doing wrong??

THanks for your help

Florian

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to