Opened 10 years ago

Closed 10 years ago

Last modified 8 years ago

#452 closed defect (fixed)

Two ManyToManyFields to the same object should give that other object two API methods, not one

Reported by: leo@… Owned by: adrian
Component: Metasystem 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 adrian)

I create two m2mfields which reference to the same class, such as this:

class Name(Model):
    name = CharField (maxlength=50)
    def __repr__(self):
        return self.name

class People(Model):
    first_name = ManyToManyField (Name)
    last_name = ManyToManyField (Name)

    def __repr__(self):
        return self.first_name

I get two tables in DB:
app_peoples_first_name and app_peoples_last_name

And i also get three apis:
set_first_name, set_last_name and get_name_list

while i think there should be two gets here: get_first_name_list and
get_last_name_list.

Change History (10)

comment:1 Changed 10 years ago by adrian

  • Description modified (diff)

Cleaned up formatting in description.

comment:2 Changed 10 years ago by adrian

  • Status changed from new to assigned

comment:3 Changed 10 years ago by adrian

  • Summary changed from M2MField doesn't work. to Two ManyToManyFields to the same object should give that other object two API methods, not one

comment:4 Changed 10 years ago by adrian

  • Component changed from Admin interface to Metasystem

comment:5 Changed 10 years ago by upadhyay@…

Isn't this a duplicate of Ticket #327, which is marked fixed?

comment:6 Changed 10 years ago by adrian

  • milestone set to Version 1.0

comment:7 Changed 10 years ago by adrian

(In [1513]) Improved model validator to throw error if a model has two ManyToMany relationships to the same model and doesn't set 'singular'. Refs #452.

comment:8 Changed 10 years ago by adrian

(In [1515]) Added unit tests to confirm #452. Refs #452.

comment:9 Changed 10 years ago by adrian

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [1516]) Fixed #452 -- Fixed bug in generated DB API for models that have two ManyToManyFields to the same related model.

comment:10 Changed 8 years ago by anonymous

  • milestone Version 1.0 deleted

Milestone Version 1.0 deleted

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