Hey guys, I'm having a bit of a problem using the get_or_create with a ManyToManyField in my model. class Run(models.Model): distros = models.ForeignKey('Distro') compilers = models.ManyToManyField('Compiler', blank=True, null=True) adapters = models.ForeignKey('Adapter')
Task = models.IntegerField() Path = models.CharField(max_length = 300) Date_Time = models.DateTimeField() class RunForm(ModelForm): class Meta: model = Run What I'm trying to do is merely trying to save in the database if the entry does not exist already (hence why I'm trying to use get_or_create). Here is how I'm doing: fields = { 'Task': task, 'Path': runpath, 'Date_Time': datetime(2012, 4, 10, 10, 20, 0), 'adapters': adapters.id, 'distros': distros.id, } form = RunForm(fields) if form.is_valid(): runs, created = Run.objects.get_or_create(**form.cleaned_data) In the compilers field I don't want to set any value this time. And what I keep getting the following error: int() argument must be a string or a number, not 'list'. Does anyone know why this is happening? Is it not possible to use the get_or_create with many to many relationship in the model? -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/utLaEo-7EAkJ. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.