Opened 19 years ago

Closed 19 years ago

Last modified 18 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 Holovaty
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: no UI/UX: no

Description (last modified by Adrian Holovaty)

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 by Adrian Holovaty, 19 years ago

Description: modified (diff)

Cleaned up formatting in description.

comment:2 by Adrian Holovaty, 19 years ago

Status: newassigned

comment:3 by Adrian Holovaty, 19 years ago

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

comment:4 by Adrian Holovaty, 19 years ago

Component: Admin interfaceMetasystem

comment:5 by upadhyay@…, 19 years ago

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

comment:6 by Adrian Holovaty, 19 years ago

milestone: Version 1.0

comment:7 by Adrian Holovaty, 19 years ago

(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 by Adrian Holovaty, 19 years ago

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

comment:9 by Adrian Holovaty, 19 years ago

Resolution: fixed
Status: assignedclosed

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

comment:10 by (none), 18 years ago

milestone: Version 1.0

Milestone Version 1.0 deleted

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