Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7765507
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T15:11:00+00:00 2026-06-01T15:11:00+00:00

I have inherited a large Django application and it features this idiom in the

  • 0

I have inherited a large Django application and it features this idiom in the model for the “shows” application:

class Movie_Playlist(models.Model):
    name = models.CharField(max_length=150)
    # More fields here...

    players = models.ManyToManyField(
        User, related_name='playlists_played', null=True, blank=True)

class PlaylistPlayer(models.Model):
    user           = models.ForeignKey(User, related_name='play_links')
    movie_playlist = models.ForeignKey(Movie_Playlist, related_name='playlist_plays')
    count          = models.IntegerField(default=0)
    last_played    = models.DateTimeField(editable=False)

    class Meta:
        db_table = 'shows_movie_playlist_players'  

As near as I can tell, the idea may be that the shows_movie_playlist_players table (which would be created by the ManyToManyField relation) is supposed to do double duty by storing per-user information in addition to just the relationship itself. Certainly, there seem to only be two related tables in the original database: “shows_movie_playlist” and “shows_movie_playlist_players”.

Also, for what it’s worth, this “validates” fine in Django 1.2.3 — 1.3.1.

This would all be fine and dandy, except that it breaks the “python manage.py test” method when it tries to create the test database since the shows_movie_playlist_players has already been created by the “ManyToManyField…” specification by the time it gets to the PlaylistPlayer class.

If I comment out the “ManyToManyField…” line, I can create the test database and run tests with no problem. Otherwise, I get this:

> python manage test shows -v3
Creating test database for alias 'default' ('test_production')...
Creating tables ...
Creating table shows_movie_playlist_players
Creating table shows_movie_playlist
Creating table shows_movie_playlist_players
Traceback (most recent call last):
  File "manage.py", line 16, in <module>
    execute_manager(settings)
    ... Lots of tracebackage here...
_mysql_exceptions.OperationalError: (1050, "Table 'shows_movie_playlist_players' already exists")

So is this a properly specified relation and overridden table that just doesn’t have support for testing yet or is something horribly wrong?

Thanks for reading!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T15:11:02+00:00Added an answer on June 1, 2026 at 3:11 pm

    Oh wow… I feel for you 🙂 Yes, it’s horribly wrong but it might have a simple solution.
    Basically it’s a hack which tries to accomplish the “through” functionality of a ManyToManyField

    Try specifying through='shows.PlaylistPlayer' on theplayers` m2m field and see how it behaves then.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have inherited a large admin winforms application that shares a 'Common' library of
I have recently inherited a large web project. Before taking this on, I had
I have inherited couple of .Net (C#) application which does not have any tracing
I have inherited an application that logs the results of certain daily commands that
I have inherited an app that generates a large array for every user that
I've inherited a rather large and somewhat messy codebase, and have been tasked with
I have a custom control inherited from RichTextBox. This control has the ability to
I have inherited this sed script snippet that attempts to remove certain empty spaces:
I have inherited an existing code base where the features are as follows: huge
This is a C# question, but really could be language-agnostic I have inherited a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.