manytomanyfield Questions
5
Solved
How can you check the type of a many-to-many-field in django?
I wanted to do it this way:
import django
field.__class__ == django.db.models.fields.related.ManyRelatedManager
This doesn't work...
Soapy asked 17/5, 2010 at 12:47
2
Solved
I started using django framework just a few days ago and i desperately need some help with my application.
It consists of client,project,admin,and admin payment classes where the admin_payment hol...
Bowdlerize asked 30/12, 2010 at 15:58
5
I have two models in Django 1.8.8:
class Company(models.Model):
name = models.CharField(max_length=200)
members = models.ManyToManyField(User)
class Folder(models.Model):
name = models.CharFiel...
Corkwood asked 15/3, 2016 at 9:12
14
I'm trying to modify a M2M field to a ForeignKey field. The command validate shows me no issues and when I run syncdb :
ValueError: Cannot alter field xxx into yyy they are not compatible types (yo...
Carabineer asked 14/11, 2014 at 10:20
4
I am running Django 1.1 and cannot get the "limit_choices_to" option for my ManytoManyField to work.
I have two models:
class MemberPhoto(ImageModel):
title = models.CharField(_('title'), max_le...
Heterocyclic asked 20/8, 2011 at 17:36
4
How can I store history of ManyToManyField using django-simple-history. I used HistoricalRecords with attribute m2m_filds but it is throwing error: unexpected keyword argument 'm2m_fields'
Sulfamerazine asked 10/2, 2016 at 10:15
5
Solved
I am new to Django and didn't find any reference regarding this issue. I am getting this error when i use many to many field in Django model (models.py). I guess the issue is assigning m2m field in...
Washburn asked 25/4, 2018 at 6:15
4
Say I have the following models that have a many-to-many relationship:
models.py:
class Foo(models.Model):
name = models.TextField()
class Bar(models.Model):
name = models.TextField()
foos = mo...
Riddick asked 10/5, 2017 at 13:42
3
Solved
I have two models that has a manytomany relationship with a 'through' table in some way?
class Bike(models.Model):
nickname = models.CharField(max_length=40)
users = models.ManyToManyField(User,...
Betony asked 2/10, 2010 at 13:9
4
I'm relatively new to DJango and I am looking to add data to a many-to-many field using serializers from rest framework.
My Model:
class IngFamily(models.Model):
name=models.CharField(max_length...
Justis asked 31/5, 2015 at 5:38
4
In Django, calling object.manytomany.all().reverse(), and its template equivalent, object.manytomany.all.reverse, don't seem to work for many-to-many relationships.
How do I reverse a list of resu...
Etra asked 20/2, 2012 at 2:56
2
Solved
Given these two Models:
class Item(models.Model):
timestamp = models.DateTimeField()
class Source(models.Model):
items = models.ManyToManyField(Item, related_name="sources")
I can find all of...
Caldera asked 17/1, 2011 at 23:42
4
Solved
I have the following models:
class Message(models.Model):
date = models.DateTimeField()
user = models.ForeignKey(User)
thread = models.ForeignKey('self', blank=True, null=True)
...
class For...
Carvel asked 18/5, 2010 at 3:15
4
Solved
I have such a Book model:
class Book(models.Model):
authors = models.ManyToManyField(Author, ...)
...
In short:
I'd like to retrieve the books whose authors are strictly equal to a given set...
Preselector asked 7/11, 2012 at 13:12
1
Solved
I have two models in Django Users and Contexts.I have defined the models as below
class User(models.Model):
userId = models.PositiveIntegerField(null = False)
pic = models.ImageField(upload_to=g...
Cornall asked 24/6, 2018 at 15:52
1
Solved
models.py
I have two models with manytomany field which makes me confuse everytime.
class Product(models.Model):
product_name = models.CharField(max_length=32)
quantity = models.IntegerField(...
Dryly asked 8/6, 2018 at 12:5
1
In Django, if I have a ManyToManyField:
class Topping(models.Model):
name = models.CharField(max_length=30)
class Pizza(models.Model):
name = models.CharField(max_length=50)
toppings = models....
Clock asked 15/4, 2018 at 16:23
4
I've got a ManyToManyField in a user object and it's used to map the users that user is following. I'm trying to show a subset list of who they have most recently followed. Is there a trick in .ord...
Phonology asked 15/12, 2009 at 3:25
2
Solved
I am trying to add an order to a ManyToMany field that I created a while ago. I basically want to order pictures in collections of pictures. I am running on Django 1.7, so no more South migrations ...
Visayan asked 13/10, 2014 at 20:22
1
Solved
I'm using a SessionWizardView from django-formtools to construct a two-form wizard. The challenge I'm facing is that I need to reference the input from the first form to limit the available queryse...
Pomfrey asked 12/3, 2017 at 19:5
0
I have a model that looks like this:
class Assignment(models.Model):
"""An assignment covers a range of years,
has multiple coders and one specific task"""
title = models.CharField(blank=True,...
Odilia asked 9/11, 2016 at 17:42
5
Solved
class Food_Tag(models.Model):
name = models.CharField(max_length=200)
related_tags = models.ManyToManyField('self', blank=True, symmetrical=False, through='Tag_Relation')
def __unicode__(self):...
Asteroid asked 9/11, 2010 at 0:35
2
I have an AngularJS project that used Django as a framework through the Django Rest Framework (DRF).
I've created a Group model and set up a serializer class for it, however I want to now establi...
Concepcionconcept asked 2/10, 2016 at 21:8
3
I want to display ManyToManyFields in admin just like filter_horizontal does, but populate the options as the user types into the filter field. There are many options and loading them all at once t...
Benthos asked 13/2, 2011 at 12:25
3
Solved
Based on the Django doc, I should be able to pass multiple objects at once to be added to a manytomany relationship but I get a
* TypeError: unhashable type: 'list'
when I try to pass a djang...
Tripp asked 10/2, 2011 at 16:4
1 Next >
© 2022 - 2024 — McMap. All rights reserved.