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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T19:43:31+00:00 2026-05-22T19:43:31+00:00

I have a model with many-to-many fields and I need to get an ID

  • 0

I have a model with many-to-many fields and I need to get an ID selected from a many to many field. I decorated a get_absolute_url method with permaling decorator. And it doesn’t work. So I understand that I need to reverse the relation, it is obvious from the trace, but I do not really understand what should I do?

Model:

class MenuItems(models.Model):
    reference_value = models.CharField(max_length=255)
    filter_ids = models.ManyToManyField(Filter, blank = True)

    def __unicode__(self):
        return u'%s' % self.reference_value

    @models.permalink
    def get_absolute_url(self): 
        return ('homepage_ids', None, {'ids': self.filter_ids })

I tried to do with the reverse(), but I have the behavior of the method didn’t changed.

    @models.permalink
    def get_absolute_url(self): 
        return reverse('homepage_ids', kwargs={'ids': self.filter_ids })
  • 1 1 Answer
  • 1 View
  • 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-22T19:43:31+00:00Added an answer on May 22, 2026 at 7:43 pm

    without seeing the url pattern.

    self.filter_ids does not return a list of ids, something like.

    self.filter_ids.all().values_list('id', flat=True)

    would return [1,2,3]

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

Sidebar

Related Questions

I have a model with many fields (nearly 40). The client wants the fields
I have a model with many fields, for which I am creating two partial
I have a Django model with 2 many-to-many fields. When the model is saved
I have a User model that has many posts. Im trying to render the
I have a model Task which will HABTM many TaskTargets. When it comes to
I have an Entry model which has many Tag s. Tag s are added
I have Product model and it has many categories with a has_many :through association
I was working on a many-to-many model with extra fields and i saw the
I have a many-to-many mapping defined (only relevant fields included) with FluentNHibernate (v1.0.0.637): //
I need to be able to call data from a different model - not

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.