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 9103301
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T01:36:14+00:00 2026-06-17T01:36:14+00:00

Scenario I have a basic Django app in which users (django’s authentication built in

  • 0

Scenario

I have a basic Django app in which users (django’s authentication built in model) and reports have a many-to-many relationship.

The Problem

Django does not create a corresponding table to handle this relationship. My application is called reports. There is an error in the admin system upon trying to create a report and assign users to it. It tries to query the table reports_report_users and it fails as it does not exist.

models.py code

 from django.db import models
 from django.contrib.auth.models import User
 class Report(models.Model):
     name = models.CharField(max_length=30, blank=False)
     users = models.ManyToManyField(User, related_name='reports')
     def __unicode__(self):
         return self.name

Attempted Solutions

  1. Used this link as a reference: https://docs.djangoproject.com/en/1.4/topics/db/examples/many_to_many/
  2. Ran manage.py syncdb about 300 times – ok, only once, but there were no errors and upon inspecting the SQLite db there were no additional tables created 🙁
  • 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-17T01:36:15+00:00Added an answer on June 17, 2026 at 1:36 am

    It seems like you’ve added to the Report model after the first sync. Thus you’re dealing with a migration, which django doesn’t do natively.

    First, Inspect the sql output, make sure that the create table instruction for your many to many relationship is there.

    python manage.py sqlall
    

    Assuming the problem is that this is a migration, which django doesn’t handle natively, you’ve got three options:
    1) Delete all db tables for this app, then run syncdb again.
    2) Manually create the tables (fairly easy to copy paste the create sql from the sqlall command)
    3) Start using a migration framework like South.

    In the long run you’ll appreciate the investment in learning south. In the short term, deleting the DB file is the fastest.-

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

Sidebar

Related Questions

I have a very basic question. Scenario: 2 forms Form1, Form2- Dialog box which
Hi I have code which sets up a basic client to server scenario and
I have this basic Drupal scenario and question: I have a form which accepts
Scenario I have a DevExpress DataGrid which is bound to a DataSet in C#.
I have a pretty basic scenario: Run 3 Google maps place URLs and show
I have a scenario where users can upload an image, OR a video (from
I have a very basic question about calculating RMSE in an NB classification scenario.
i have what seems like a basic scenario for a db trigger in SQL
I have what I think is a very basic scenario, but what I've read
This is a pretty basic scenario but I'm not finding too many helpful resources.

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.