Wednesday, January 22, 2020

Re: Django Rest - ManyToManyField with SlugRelatedField Data Is Not Being Created

Erika i think your models are not implemented correctly ..
why you have a foreign key field in TagLink linking to Tags , while you already have a manytomany relation between the Tag and Calculator through TagLink !!!!
try to remove the tag field from     " 
through_fields=('calculator', 'tag') "
or remove " tag = models.ForeignKey(Tag, on_delete=models.CASCADE, db_column='sTag') "

I think you are making a circular relation 

On Wed, Jan 22, 2020 at 5:06 PM Érika Barros <sbarros.erika@gmail.com> wrote:
Hello friends!

I have a detailed question on this link (Stack Overflow).

In resume, I can't create a new object on database using SlugRelatedField by the method create() and I receive the following error:

return CalculatorNotFoundException(logger, request_json['name']).response

Can anybody help me?

Thank you so much!!!

Érika.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/bced6744-7c53-460f-b3a4-dc6c0aaec252%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAHV4E-dTXUDgrHXLv9Gv2Z42Mp09F8o3HNGi70bJ2gdrZo6Q0g%40mail.gmail.com.

No comments:

Post a Comment