Dear Anyone,

I'm having an issue with a ManyToMany "through" table not being recognized
by the makemigrations command. Please consider the model definitions at the
following pastebin: http://pastebin.ubuntu.com/12011412/

So, I have a Player model. Players are stored and updated in that model
(also for clarification, the Player model is in a separate app because it's
used for other purposes). The League model, when created, makes available
all of the Player objects in the DB for drafting to a LeagueTeam. That's
why there's a "through" table for LeaguePlayer, since I don't want to
affect the original Player object, and I want to add the additional
information as to what LeagueTeam the LeaguePlayer got drafted to (think
fantasy football).

However, I'm getting errors in the console about the draft_leagueplayer
(the relevant app's name is "draft") table not existing, and I noticed it's
not getting created in the db. After a little digging, I realized that
ultimately the django.apps.config module's AppConfig.get_models() method is
set to ignore any apps with "auto_created = True" by default, thus ignoring
LeaguePlayer. If you look at the pastebin above, I am adding Player objects
to the League as soon as it's created, and the "auto_created = True" meta
attribute helps me do that easily.

I'm wondering if there is a way around this. I need extra information in
this Many-to-Many relationship (the team the player is drafted to), and I'm
surprised the auto_created attribute exists and doesn't seem to work (since
the migration ignores the model). Is this a bug, or should I be manually
creating LeaguePlayer objects on-the-fly when adding to the League object
instead of using auto_created? Am I misusing auto_created?

Joey "JoeLinux" Espinosa
about.me/joelinux
[image: Joey "JoeLinux" Espinosa on about.me]
  <http://about.me/joelinux>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAKXnPv%2BRec6xdeeaTvAkj%2BJp%2B73PwPTro4JTwnKW4tSSKKHZUQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to