Hi all,
I have a class with a many2many field:
class Previsione(models.Model):
nave = models.CharField(maxlength=50)
data_manovra = models.DateField()
h_inizio = models.TimeField()
rims = models.ManyToManyField(Rim)
into the views.py I use this code to save the submitted data:
....
if req.method == 'POST':
myform = nf.models.form_for_model(Previsione)(req.POST)
if myform.is_valid():
dati = myform.save(commit=False)
if varid is not None:
dati.id=varid
dati.save()
dati.rims = req.POST.getlist('rims')
return HttpResponseRedirect('.')
else:
....
but when I update the data the old rims are deleted and the new inserted ... is
possible to UPDATE the rims data ? cioe', is possible to leave unchanged the
rims data if are the same ?
tanks in advance ...
--
#include <stdio.h>
int main(void){char c[]={10,65,110,116,111,110,105,111,32,98,97,114,98,111,110,
101,32,60,104,105,110,100,101,109,105,116,64,116,105,115,99,97,108,105,110,101,
116,46,105,116,62,10,10,0};printf("%s",c);return 0;}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---