Questions tagged [m2m]

A type of relationship between entities of types A and B which associates a list of entities of type B to an entity of type A and vice versa. Types A and B may be the same type

A type of relationship between entities of types A and B which associates a list of entities of type B to an entity of type A and vice versa. Types A and B may be the same type.

See also:

271 questions
0
votes
1 answer

django "is a manually-defined m2m relation through model...which does not have foreign keys to"

There have been some close ones on this, but all I can find is what I'm doing and its not working. Here is an example: You have a product which can have multiple options. Each option can have multiple choices. class Option_Choices(models.Model): …
Jason G
  • 2,395
  • 2
  • 24
  • 34
0
votes
1 answer

Abort save in m2m_changed phase with Django

I need to save a django many-to-many field to a third-party server when saving a model. However, the third party server might be unavailable, in which case I need to abort the whole save operation. Is it possible to abort saving a model from the…
Ozzee
  • 1
0
votes
1 answer

Django: how to execute code ONLY after the first time a M2M relationship is added?

I'm trying to get create_reminder_send_message() executed THE FIRST TIME the Reminder object is saved AND the Reminder.users is saved. The code as it is executes every time I update the object... what am I missing? How can I accomplish what I…
la_f0ka
  • 1,773
  • 3
  • 23
  • 44
0
votes
1 answer

Signal m2m_changed never triggered

class Lab(Model): pass class School(Model): labs = ManyToManyField(Lab, related_name='schools') def m2m_changed_labs(*args, **kwargs): pass m2m_changed.connect(m2m_changed_labs, sender=Lab.schools) The m2m_changed signal is never…
user2282405
  • 873
  • 2
  • 9
  • 10
0
votes
1 answer

Django - assign m2m relationship in admin

In the app I'm building some users have the role "Coder" and are assigned to "Assignments". What I can't seem to get working is the process of an Admin assigning Coders to Assignments. Here is the Model-Code I have so far (probably totally…
LukasKawerau
  • 1,071
  • 2
  • 23
  • 42
0
votes
1 answer

get all the items that belong to yellow boxes in Django models

So i have this simplified version of what i'm attempting to do and failing. I have this Boxes objects that has a color field, and can have many items by an m2m field, so i want a list(a queryset) of all the items that are in boxes of an specific…
Guillermo Siliceo Trueba
  • 4,251
  • 5
  • 34
  • 47
0
votes
1 answer

Django define m2m field conversion (from to string)

I'm trying to work with m2m fields. What I want to do is to have a string (CharField) where user can write the tags of a post, with each tag separated by commas. I was able to do the creation in this way: tags = tags.split(',') for tag in…
EsseTi
  • 4,079
  • 5
  • 36
  • 63
0
votes
1 answer

letting only the creator edit a Category in django

In my web app,I have a m2m relation between a Category and a User class Category(models.Model): users = models.ManyToManyField(User,related_name='category_users') title = models.CharField(max_length=200) description =…
damon
  • 8,127
  • 17
  • 69
  • 114
0
votes
1 answer

How to display fields of a M2M relation

I have this Django model: #encoding:utf-8 from django.db import models from django.contrib.auth.models import User from django.contrib import admin # Create your models here. class Profile(models.Model): user = models.ForeignKey(User,…
lordzero0000
  • 23
  • 1
  • 6
0
votes
1 answer

access serial port through internet which is connected to a remote machine

I have a sensor gateway which is connected to the serial port. My java program basically a desktop application which is collecting sensor data and storing in a public mysql database. Now I am wanting to access the serial port through internet with a…
Shantanu Banerjee
  • 1,417
  • 6
  • 31
  • 51
0
votes
0 answers

M2M vechile/mobile tracing

i am going to create a server application where i can see the details of my vehciles/mobiles location. I am new to this concept.i want to know that what type of data that hardware(installed on vehciles) will send to server.i mean is it SMS or…
Balwinder SIngh
  • 1,831
  • 2
  • 24
  • 28
0
votes
1 answer

Protocol for device tracking

I want to create a server through which i can track devices(mobile,vechile etc etc). How can i create a protocol that can accept commands from all type of devices.
Balwinder SIngh
  • 1,831
  • 2
  • 24
  • 28
0
votes
1 answer

Search models defined with "through"

I have the following models (details are omitted): class Author(models.Model): name = models.CharField('name', max_length=200, blank=False) class Book(models.Model): title = models.CharField('title', max_length=200, blank=False) …
Asterisk
  • 3,534
  • 2
  • 34
  • 53
0
votes
1 answer

Django - many to many with post_save gridlock

I want to send out an email when a model instance is saved. To do this I listen out for the post_save signal: #models.py @receiver(post_save, sender=MyModel, dispatch_uid="something") def send_email(sender, **kwargs): instance =…
powlo
  • 2,538
  • 3
  • 28
  • 38
0
votes
1 answer

How to get tool-readable XMI with Atlas Transformation Language

I'm a beginner with Atlas Transformation Language and have already made some steps with transforming models based on severeal meta-models. Now I want to transform a specified model based on metamodel1 to a uml-model based on the uml-metamodel. The…
martin
  • 2,957
  • 3
  • 25
  • 46
1 2 3
18
19