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

  • Home
  • SEARCH
  • 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 6200927
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T04:27:30+00:00 2026-05-24T04:27:30+00:00

I just do not know how to create model for categories. I’ve got some

  • 0

I just do not know how to create model for categories. I’ve got some users which can post messages for one or many groups. There will be one category for each message, so visiters will be able to filter all messages for this category. I thought about such realisations:

  • One table for all categories, for all users. I’ll have in admin panel autocomplete widget that will check for available category and if there no correct categories user will add them through “plus” icon or, maybe, with redefinition of save method I’ll add new category to database.
  • Categories – just CharField in model. So I’ll get all categories through split() method and somehow put it on my webpage.

Maybe there other ways to create categories for messages? Something, which can separate categories for different users.

  • 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-24T04:27:31+00:00Added an answer on May 24, 2026 at 4:27 am

    Create a model called Category that will hold all of your categories, then create a ForiegnKey relationship from Message to Category to hold the category for that message, and a ManyToMany relationship from UserProfile to Category to hold all of the categories for a certain user.

    class Category(models.Model):
        name = models.CharField(max_length=30)
    
    class Message(models.Model):
        ...
        category = models.ForeignKey(Category)
    
    class UserProfile(models.Model):
        ...
        categories = models.ManyToManyField(Category)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Well I know it's not evil just not as pretty in semantics as <strong>
This just won't work. The problem is that I do not know enough to
I know this has been asked different ways several times, but I'm just not
I feel like this is something I should already know, but I'm just not
I know I could just make all the Mix_Musics public, and not worry about
I know it is still not quite popular, since the spec was released just
As I know Samsung Bada is not operating system but, just wonder if I
I know that an interface does not have a body, just a method definition.
I am not concerned about other kinds of attacks. Just want to know whether
I'm not asking if these are truly random. I just wanted to know if

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.