Hello,
update your models.py:
class Course(models.Model):
name = models.TextField()
students = models.ManyToManyField(Student, related_name='courses')
*users = models.ManyToManyField(User)*
Update your views.py:
def create_item(request):
if request.method == 'POST':
for
Hi,
Thanks very much, I can now save the item.component and item.category many
to many fields.
However I can't save the user as request.user and it still boils down to
not quite understanding how to specify a field value to be saved.
I've tried variations of my original code and suggestions onli
Hello,
This works for me, saving the related objects in the many to many
relationship. You can start from there to build yours:
models.py:
class Student(models.Model):
name = models.TextField()
class Course(models.Model):
name = models.TextField()
students = models.ManyToManyField
Hi Camilo,
I really appreciate your response.
I had another go at this last night, particularly trying to use the
add(component()) snippet.
To respond to your notes:
1. I simplified and used a find-replace to replace the model names which is
likely why it dosn't compile, sorry about that. Mine c
On Saturday, April 5, 2014 10:12:36 PM UTC-4:30, Jason S wrote:
>
> I've seen quite a few examples showing various ways to create a form using
> manytomany relationships and save the data, but i'm still missing a key
> piece of the puzzle.
> I've created a form and it "works", meaning the form cr
Hi,
I've seen quite a few examples showing various ways to create a form using
manytomany relationships and save the data, but i'm still missing a key
piece of the puzzle.
I've created a form and it "works", meaning the form creates a new Item
object and associates the user.
However i'm not sure
6 matches
Mail list logo