Ticket #1578: validate-edit-inline.diff

File validate-edit-inline.diff, 1.1 KB (added by mir@…, 19 years ago)

get_validation_errors must check edit_inline attribute

  • django/core/management.py

    a b def get_validation_errors(outfile, app=N  
    10561056
    10571057        # Check core=True, if needed.
    10581058        for related in opts.get_followed_related_objects():
    1059             try:
    1060                 for f in related.opts.fields:
    1061                     if f.core:
    1062                         raise StopIteration
    1063                 e.add(related.opts, "At least one field in %s should have core=True, because it's being edited inline by %s.%s." % (related.opts.object_name, opts.module_name, opts.object_name))
    1064             except StopIteration:
    1065                 pass
     1059            if related.edit_inline:
     1060                try:
     1061                    for f in related.opts.fields:
     1062                        if f.core:
     1063                            raise StopIteration
     1064                    e.add(related.opts, "At least one field in %s should have core=True, because it's being edited inline by %s.%s." % (related.opts.object_name, opts.module_name, opts.object_name))
     1065                except StopIteration:
     1066                    pass
    10661067
    10671068        # Check unique_together.
    10681069        for ut in opts.unique_together:
Back to Top