Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#1499 closed defect (invalid)

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

Reported by: pascalbarbedor@… Owned by: adrian
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: UI/UX:

Description (last modified by lukeplant)

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 Changed 9 years ago by lukeplant

  • Description modified (diff)

comment:2 Changed 9 years ago by jacob

  • Resolution set to invalid
  • Status changed from new to closed

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 Changed 9 years ago by adrian

  • milestone Version 0.91 deleted

Milestone Version 0.91 deleted

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