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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T03:44:02+00:00 2026-05-23T03:44:02+00:00

I have created the following M2M table with an intermediary model — class Position(models.Model):

  • 0

I have created the following M2M table with an intermediary model —

class Position(models.Model):
    position = models.CharField(max_length=100)

class UserProfile(models.Model):
    user = models.ForeignKey(User, unique=True)
    positions = models.ManyToManyField(Position, through ='Timestamp', blank=True, null=True)

class Timestamp(models.Model):
    created_at = models.DateTimeField(auto_now_add=True)
    position = models.ForeignKey(Position)
    userprofile = models.ForeignKey(UserProfile)

I have created the following entries so far —

>>> entry1 = Timestamp(userprofile=userprofile, position=position1)
>>> entry2 = Timestamp(userprofile=userprofile, position=position2)

Now I have two entries in the userprofile_timestamp table

-- profile & position1
-- profile & position2

How would I delete the profile & position1 entry? In the docs (https://docs.djangoproject.com/en/dev/topics/db/models/#extra-fields-on-many-to-many-relationships) it mentions using profile.positions.clear() to clear ALL the entries, but how would I remove a single entry? Thank you.

  • 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-23T03:44:03+00:00Added an answer on May 23, 2026 at 3:44 am
    >>> profile.positions.through.objects.get(position=position1).delete()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an ExpenseType object that I have created with the following migration: class
I have created the following class. However, I cannot get past the error: Must
If I have created the following Employee object (simplified)... public class Employee { public
I have created the following class implementing a ListSelectionListener interface. This class should listen
I have created the following trigger for insert in the deleted user table the
I have created following adapter: package org.virtualbet.gui.util; import java.util.List; import org.virtualbet.R; import org.virtualbet.model.Tip; import
I'm writing an MVC2 app using DataAnnotations. I have a following Model: public class
I created the following class to model a person: namespace DataBindingTest { public enum
I have created the following class that extends JSpinner to iterate over dd/mm/yyy values.
Let's say I have created the following matrix: > x <- matrix(1:20000,nrow=100) > x[1:10,1:10]

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.