manytomanyfield Questions

1

I have a UserProfile model that refers to my User model with a OneToOneField. I also use the post_save signal to auto create the UserProfile when the user is created. This works great apart from wh...
Branchia asked 18/11, 2015 at 11:55

1

Solved

I have a Django db with cooking recipes. I want to query all users who have at least 80% ingredients to make a recipe. How do I achieve this? Or how do I query for users who are missing only 1 ing...
Overrate asked 6/7, 2015 at 7:22

2

Solved

I am having this weird problem accessing ManyToManyField. I have following models. class Link(models.Model): title = models.CharField(max_length = 200) url = models.URLField(unique = True) tag...
Eleneeleni asked 11/3, 2014 at 14:56

3

Solved

I have a method that works, but it seems very clumsy, and I would think there is a better way to do this. I have a Model that relates a user on my site (a twitter clone for learning purposes) to a...
Mehalek asked 23/12, 2010 at 4:34

2

Solved

Suppose i have : class Album(models.Model): photos = models.ManyToManyField('myapp.Photo') photo_count = models.IntegerField(default = 0) class Photo(models.Model): photo = models.ImageField(...
Dowse asked 10/11, 2012 at 10:54

4

Solved

I hope I'm wrong, but it looks to me like the only way to have no help_text for a ManyToManyField is write an __init__ method for the form and overwrite self.fields[fieldname].help_text. Is that re...
Photoluminescence asked 13/7, 2010 at 22:50

4

Solved

Is there a simple way to show a ManyToManyField as Checkboxes in Django Admin? Thanks in advance!
Stereoscopic asked 24/1, 2011 at 16:45

2

I am trying to count the distinct values from a group of objects that have a manytomanyfield e.g. object article has manytomanyfield of tag objects one article has tags "tag1" "tag2" another ...
Coriolanus asked 25/12, 2010 at 1:7

2

I'm having a simple Gallery model, that is related to an Image model via a many-to-many relationship through a table that has an ordering-attribute: # models.py class Image(models.Model): .... c...
Ernaernald asked 3/12, 2010 at 13:36

2

In the change list of the django admin, I want to use list_editable to display a django-autocomplete widget for a ManyToManyField. I found something similar here: list_editable and widgets Normal...
Hotheaded asked 2/10, 2011 at 22:57

1

I've written a couple of tests for really simple blog app, but the many to many relationship fails when I run the test: ./manage.py test myblog DatabaseError: no such table: myblog_post_tag Yet ...
Carlitacarlo asked 28/8, 2012 at 2:23

2

Solved

this is the representation of my models: class B(models.Model): """I'm a dummy model, so doesn't pay atention of what I do""" name = models.CharField(max_length=250) class A(models.Model): nam...
Constantina asked 1/12, 2011 at 15:14

1

I've made a model (models.py): class opetest(models.Model): name = models.CharField(max_length=200) author = models.ForeignKey(User, related_name='author') description = models.TextField(u'Test...

1

Solved

I have the following Django model: class Icon(models.Model): name = models.CharField(max_length=200,null=False,blank=False) class Post(models.Model): icons = models.ManyToManyField(Icon) When...
Plutocrat asked 31/8, 2011 at 17:5

1

Solved

This time I think it's not me being stupid but an actual conflict. I have the below code (simplified): from django.db import models class Alpha(models.Model): relation = models.ForeignKey('Delta...
Neap asked 25/4, 2011 at 15:2

1

Solved

I use Django and I have some objects with ManyToManyFields. I'd like to duplicate these objects. I've found 'deepcopy' which works almost perfectly. >>> e = Equipement.objects.get(pk=568)...
Norther asked 14/6, 2011 at 16:9

1

Solved

My modelform has a field with a ModelMultipleChoiceField that has a queryset to a Category object. The problem is the form submits, but the Category data doesn't save. Thoughts? Many thanks! Form...
Yep asked 13/1, 2011 at 19:57

2

Given a model like this: class A(models.Model): def __unicode__(self): return "%d"%self.id class B(models.Model): a_set = models.ManyToManyField(A) def __unicode__(self): return "%d"%self.i...
Touraco asked 28/2, 2010 at 11:13

2

Solved

i have the following models: class Tag(models.Model): tag_name = models.CharField(max_length=250) tagcat = models.ForeignKey('TagCat') class Subject(models.Model): user = models.ManyToManyFiel...
Arbitress asked 30/11, 2010 at 22:42

1

Solved

The site I'm building allows users to create "posts" and has a Twitter-like concept of followed users. For a given user, I'd like to show all of the posts from the users that they follow. Here are...
Arnold asked 26/11, 2010 at 18:43

2

Solved

I have a django model (A) which has a ManyToManyField (types) to another model (B). Conceptually the field in A is an 'optionally limit this object to these values'. I have set blank=null and null=...
Francesco asked 12/10, 2010 at 10:7

2

Solved

Considering the following models, knowing a family, how do I select Kids with no buyers? class Family... class Kid(models.Model): name = models.CharField(max_length=255) family = models.Foreign...
Synergism asked 4/10, 2010 at 14:49

1

Solved

I've been working through an ordered ManyToManyField widget, and have the front-end aspect of it working nicely: Unfortunately, I'm having a great deal of trouble getting the backend working. T...
Marvelofperu asked 6/7, 2010 at 22:37

2

Solved

Lets say I have two django apps: competitions - which will handle competition data entries - which will handle functionality relating to entering competitors into competitions In the competitio...
Azygous asked 28/12, 2009 at 16:50

3

Solved

I've got a couple django models that look like this: from django.contrib.sites.models import Site class Photo(models.Model): title = models.CharField(max_length=100) site = models.ForeignKey(Si...
Brumaire asked 5/12, 2008 at 22:32

© 2022 - 2024 — McMap. All rights reserved.