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 really the only way? I prefer to use CheckboxSelectMultple widgets, so am I really going to have to define an __init__ method for any form that ...
It seems to me that the current django release (starting with 1.2) requires a many-2-many join table to have its own id field and that this key is its primary key. Is that true?
I have some applications which are using legacy databases in which the many-2-many table have primary keys consisting of both foreign keys. But those applicatio...
Hi!
I need help on how to save the same (reference to an) object into a ManyToManyField.
For example I have models like this:
class Material(models.Model):
name = models.CharField(max_length=50)
class Compound(models.Model):
materials = models.ManyToManyField(Material)
In this example, the Compound can be made of one or many...
I am using a post_save signal on an instance.
In the callback I would like to add elements to the ManyToManyField of this very instance (named 'locales').
Here is my code:
def after_insertion(sender, instance, **kwargs):
locale = Locale(locale='en')
locale.save()
instance.locales.add(locale)
Locale instance is created but...
If I have two Models that have a manytomany relationship with a through model, how do I get data from that 'through' table.
class Bike(models.Model):
nickname = models.CharField(max_length=40)
users = models.ManyToManyField(User, through='bike.BikeUser')
The BikeUser class
class BikeUser(models.Model):
bike = models.F...
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, through='bike.BikeUser')
The BikeUser class
class BikeUser(models.Model):
bike = models.ForeignKey(Bike)
user = model...
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.ForeignKey(Family)
buyer = models.ManyToManyField(Buyer, blank=True, null=True)
family = get_object_or_404(Family, pk=1)
for_sale = family...
I want to have a model with a ManyToMany relationship with itself, I don't know how to write this but I'l try to write some code to illustrate what I want to do.
class Person(models.Model):
name = models.CharField()
occupation = models.CharField()
fiends = models.ManyToManyField('self', through = PersonFiends)
My Model that ...
I seem to have a problem with Django when it comes Rendering ManyToManyField in a template. I can make it work partially, but I cannot make it work properly as I want it.
Firstly I have an invoice template which displays Invoice details from my data base
#invoice_details.html
{% extends "base.html" %}
{% block content %}
<h2>Invoice D...
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=True on the ManyToManyField. I have created an object from this model, and set types to some values. All is good.
I want to set it to 'null',...
Hello, I seem to have a problem displaying work orders. in my app. The clients does not have the same problem so why does the work orders not show up. Actually it is as almost as a black space appears rather than text that should appear from my database.
The problem seems to be because work orders have a many-to-many field. If I have {{...