Opened 19 years ago

Closed 19 years ago

Last modified 18 years ago

#1499 closed defect (invalid)

records with foreignkey do not change after an edit from parent page

Reported by: pascalbarbedor@… Owned by: Adrian Holovaty
Component: contrib.admin Version:
Severity: normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Luke Plant)

I tried the example Poll choices from the tutorial and it works.
ie if i change a choice from poll page it is updated

now with this model

which seem to me is completely equivalent, any edit that concern data from rubrique page is silently ignored
but if i put wrong entry in the fields i still have the error page.

SUPPORT_CHOICES = (
('PCS', 'PCS'),
('ROME', 'ROME'),
('FAP', 'FAP'),
('NSF', 'NSF'),
('PRODUIT', 'FORMATION'),
('TITRE', 'TITRE'),
('IDSSC', 'sous secteur'),
('FORMAC', 'formacode'),
('NAF', 'NAF'),
)




THEME_CHOICES = (
('MDT', 'Emploi, Marché du travail'),
('AFPA', 'Formations AFPA'),
('OBS', 'Observatoires'),
('CERT', 'Diplômes, Certification'),
('FC', 'Formation continue'),
)



ZONE_CHOICES = (
(1, 'France'),
(3, 'Régions'),
(7, 'Départements'),
(11, 'Zones d''emploi'),
(15,'Zones d''emploi et départements'),
(31,'Centres de formation'),
)


class Rubrique( meta.Model):
    theme = meta.CharField(maxlength=150, choices=THEME_CHOICES)
    rubrique = meta.CharField( 'rubrique', maxlength=50)
    info = meta.TextField(maxlength=100, blank=True)
    def __repr__(self):
        return self.rubrique

    class META:
        admin = meta.Admin(
            list_display = ( 'rubrique','theme', 'info'),
        )



class Data( meta.Model):
    data = meta.CharField( maxlength=15,  core=True)
    
    rubrique = meta.ForeignKey(Rubrique, edit_inline=meta.TABULAR, num_in_admin=10)
    
    lb = meta.CharField( 'label', maxlength=60, core=True)
    lc = meta.CharField('label court', maxlength=20, core=True, blank=True)
    source = meta.CharField( maxlength=20, core=True, blank=True)
    table = meta.CharField( maxlength=20, core=True, blank=True)
    tfield = meta.CharField( maxlength=20, core=True, blank=True)
    support = meta.CharField(maxlength=15, choices=SUPPORT_CHOICES, core=True, blank=True)

    zones = meta.IntegerField( maxlength=20, choices=ZONE_CHOICES, core=True, blank=True)
    #~ class META:
        #~ admin = meta.Admin(
            #~ list_display = ('rubrique','data', 'lb','lc', 'source','table','tfield','support','zones'),
        #~ )

    def __repr__(self):
        return "%s [%s]" % (self.lb, self.data)

    

Change History (3)

comment:1 by Luke Plant, 19 years ago

Description: modified (diff)

comment:2 by Jacob, 19 years ago

Resolution: invalid
Status: newclosed

There's far too much going on here to figure out what's going on. Unless you're sure this is a bug in Django, please use django-users for support requests; if you're going to file a bug please pare down the sample code to the bare minimum.

comment:3 by Adrian Holovaty, 18 years ago

milestone: Version 0.91

Milestone Version 0.91 deleted

Note: See TracTickets for help on using tickets.
Back to Top