Opened 19 years ago
Last modified 18 years ago
#1499 closed defect
records with foreignkey do not change after an edit from parent page — at Version 1
Reported by: | 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 )
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)
Note:
See TracTickets
for help on using tickets.