Hola Luis, eres muy amable en responderme tan rápido, mi pregunta puntual
es de que manera puedo hacer un update en una tabla de muchos a muchos.


Estos son mis dos modelos


class Articulo(models.Model):
    titulo = models.CharField(max_length=255, blank=True)
    texto = models.TextField()
    url = models.CharField(max_length=255)
    fuente = models.ForeignKey(Fuente, on_delete=models.CASCADE) #
    fecha = models.DateTimeField(null=True)
    created_at = models.DateTimeField(auto_now_add=True, auto_now=False,
verbose_name=u'Fecha de creación')
    ubicacion = models.CharField(max_length=255)
    tipo_facebook = models.CharField(max_length=255)
    id_articulo_facebook = models.CharField(max_length=255,blank=True,
null=True)

----------------------------


class Articulo_Consolidacion(models.Model):
    articulo =  models.ForeignKey(Articulo, on_delete=models.CASCADE)
    tag = models.ForeignKey(Tag, on_delete=models.CASCADE)
    tono = models.ForeignKey(Tono, on_delete=models.CASCADE)
    tema = models.ForeignKey(Tema, on_delete=models.CASCADE)

quedo muy atenta a tu respuesta.

Muchas gracias


El lun., 8 de abr. de 2019 a la(s) 21:11, Luis Zárate (luisz...@gmail.com)
escribió:

> Hola,
>
> Las relaciones M2M pueden trabajarse de diferentes formas, acá está la doc
> de django
> https://docs.djangoproject.com/en/2.2/topics/db/examples/many_to_many/
>
> Si lo que quieres es hacer algo rápido puedes usar un model form factory
>
>
> https://docs.djangoproject.com/en/2.2/topics/forms/modelforms/#modelform-factory-function
> del  modelo que desear y luego relacionarlo con el objeto que quieras por
> ejemplo
>
> Si lo único que necesita es relacionarlos porque los tiene ya creados
> entonces puede hacer  un formulario y usar un campo como 
> ModelMultipleChoiceField
> (
> https://docs.djangoproject.com/en/2.2/ref/forms/fields/#django.forms.ModelMultipleChoiceField
> )
>
> Si puedes dar un mejor ejemplo de lo que quieres hacer le podemos ayudar
> más.
> Saludos.
>
>
>
>
>
> El lun., 8 abr. 2019 a las 17:40, <tatianamesa...@gmail.com> escribió:
>
>> Hola, me gustaría saber de que manera se hace un update cuando tengo una
>> relación de muchos a muchos en django, apreciaría mucho sus ayudas :)
>>
>> --
>> 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+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/64971258-aa7b-4a4b-9532-94f0272e94a3%40googlegroups.com
>> <https://groups.google.com/d/msgid/django-users/64971258-aa7b-4a4b-9532-94f0272e94a3%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
> --
> "La utopía sirve para caminar" Fernando Birri
>
>
> --
> 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+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAG%2B5VyM2J5y9WrUC9YPwJ6PeH6zNboJK%3D4hAScVDFAB%2B6vsMjA%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAG%2B5VyM2J5y9WrUC9YPwJ6PeH6zNboJK%3D4hAScVDFAB%2B6vsMjA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHAr%3D_21PiVzQD%2B_q5D-ynGmYffZB4YQjAaGmGJdPeNEvhKoUg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to