m2m Questions
2
Solved
I have the following model classes:
class Category(models.Model):
category = models.CharField('category', max_length=200, blank=False)
class Book(models.Model):
title = models.CharField('title'...
6
Solved
I'm experiencing a weird problem which I hope someone in here may be able to shed some light on.
I'm overriding the save() method of a model to add some values to a ManyToMany-field after running ...
Persephone asked 1/6, 2011 at 11:12
3
I have the following model schema in Django (with Postgres).
class A(Models.model):
related = models.ManyToManyField("self", null=True)
Given a QuerySet of A, I would like to return a dictiona...
Robtrobust asked 30/6, 2013 at 7:41
3
Solved
My models.py looks like this:
class IP(models.Model):
name = models.CharField(max_length=30, unique=True)
address = models.CharField(max_length=50, unique=True)
class IPGroup(models.Model):
na...
Littoral asked 26/9, 2018 at 7:13
1
I am having trouble to figure out whether my signal handler is called during fixture loading or not. Most of my signal handlers receive an extra keyword raw when django load fixtures. However, this...
5
Solved
i am working on saving on the same form two tables - having a m2m relation.
I don't succeed, my error persists with something like: Cannot set values on a ManyToManyField which specifies an interme...
2
I have 2 tables: restaurants and foods, and a 3rd table restaurants_foods which stores the many to many relationship between the 2 tables
restaurants_foods = db.Table('restaurants_foods',
db.Colu...
Boothman asked 4/3, 2016 at 12:9
1
Solved
class User(models.Model):
name = models.CharField(max_length=100)
age = models.IntegerField()
gender = models.IntegerField()
email = models.CharField(max_length=100)
password = models.CharFiel...
Photima asked 23/8, 2017 at 19:29
4
Solved
I'm having trouble in saving a m2m data, containing a 'through' class table.
I want to save all selected members (selected in the form) in the through table.
But i don't know how to initialise the ...
4
ok i think this is very basic, but since I am new to Django I don't know how to handle this.
I need to copy an instance of a django-model. As explained here, there is a problem with copying ManyTo...
2
Solved
An example Many-to-Many through relationship in Django:
class First(models.Model):
seconds = models.ManyToManyField(Second, through='Middle')
class Middle(models.Model):
first = models.ForeignK...
Jink asked 27/7, 2015 at 14:42
2
I'm building a small ruby program to run a connection to a MQTT server and subscribe to a channel. I'm using the mosquitto gem which is just a bridge for libmosquitto C library.
I created a very s...
Coraleecoralie asked 20/5, 2014 at 10:35
1
Solved
I am not very familiar with Django's signals and could use some help.
How do I modified the pk_set before the instance is saved? Do I have to return something to the signal caller (like the kwargs...
Comp asked 21/10, 2014 at 18:2
1
Solved
I am using django-restframework for my API. I created a serializer which should list my objects and should be able to create them.
I have a Contact entity and Product. There is a standard m2m betwe...
Modestomodesty asked 10/9, 2014 at 7:30
4
I recently started to use signals in my Django project (v. 1.3) and they all work fine except that
I just can't figure out why the m2m_changed signal never gets triggered on my model. The Section ...
Matti asked 24/6, 2011 at 5:40
1
Solved
I'm trying to use Tastypie with ManyToMany relationships using intermediate models (through keyword) (https://docs.djangoproject.com/en/dev/topics/db/models/#extra-fields-on-many-to-many-relationsh...
Fraud asked 17/7, 2012 at 15:20
1
Solved
I'm trying to get a many to many model to update when I save a related model. This should be possible using the m2m_changed signal (and it works! but not in the admin?) e.g.
# i want the reference...
1
I'd like to keep track on what field has changed on any model (i.e. audit at model level since it's more atomic, not at admin/form-level like what django and django-reversion can already do). I'm a...
Biradial asked 20/1, 2011 at 8:14
2
Hi I have a model which has 2 many to many fields in it. one is a standard m2m field which does not use any through tables whereas the other is a bit more complecated and has a through table. I am ...
Artimas asked 23/12, 2009 at 14:20
3
I'm trying to get the related_name of a many-to-many-field. The m2m-field is located betweeen the models "Group" and "Lection" and is defined in the group-model as following:
lections = models.Ma...
Middlebuster asked 17/5, 2010 at 15:27
1
Solved
First I'll lay out what I'm trying to achieve in case there's a different way to go about it!
I want to be able to edit both sides of an M2M relationship (preferably on the admin page although if ...
Sprout asked 9/11, 2009 at 10:27
1
© 2022 - 2025 — McMap. All rights reserved.