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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T18:46:14+00:00 2026-05-24T18:46:14+00:00

I am new to Django and I getting some difficulties in implementing this model

  • 0

I am new to Django and I getting some difficulties in implementing this model in Django:

enter image description here

Until now I have the model working without the table “Positions”, and looks like this:

from django.db import models
import datetime

class Category(models.Model):
    n_category = models.CharField(max_length=100)

class Directory(models.Model):
    website_name = models.CharField(max_length=200)
    website_url = models.URLField()
    categories = models.ManyToManyField(Category)

My question is, How can I add the table “Positions” to this model?

Please give me a clue.

Best Regards.

  • 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-05-24T18:46:15+00:00Added an answer on May 24, 2026 at 6:46 pm

    Create a the model Position which has ForeignKeys to Categories and Directory and all the other data needed. And then use the through argument for the ManyToManyField. This is described in the Django documentation

    Example (which if haven’t tested):

    class Position(models.Model):
        website_postiton = models.IntegerField()
        category = models.ForeignKey('Category')
        directory = models.ForeignKey('Directory')
    
    class Category(models.Model):
        n_category = models.CharField(max_length=100)
    
    class Directory(models.Model):
        website_name = models.CharField(max_length=200)
        website_url = models.URLField()
        categories = models.ManyToManyField(Category, through=Position)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm rather new to Django and I'm using Django 1.0. I have this: forms.py:
I'm new to Django but I seem to have nearly identical code working on
I am new to Django and have started working on a mature Django project.
I'm new to Django. I have created a new App called Directorio and now
New to Django so sorry if this is trivial I have a base.html template
I'm working on a new Django project, and the client wants to feature content
I'm new to Django, but the application that I have in mind might end
i am fairly new to django and i want to update some of my
I am very new to apache and django, so execuse me if this question
I'm slowly getting into the position where one of my Django sites needs some

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.