See https://github.com/django-parler/django-parler

2016-09-12 23:02 GMT-06:00 Hanh Kieu <hhk...@gmail.com>:

> Hey guys, I'm creating a translation app that allows you to translate from
> one object to the other. My translation model has two foreign keys that
> links to two words, and on the admin site I want the Admin to be able to
> input two different words. The words they enter should be saved as
> individual words, as well as a translation. However, it looks like this
> isn't possible at all in Django. I've been trying so hard to read
> documentation but I am struggling. My Models look like this:
>
> class Language(models.Model):
>     language_text = models.CharField(max_length=200)
>
>     def __str__(self):
>         return self.language_text
>
>
> class Word(models.Model):
>     language = models.ForeignKey(Language, on_delete=models.CASCADE)
>     word_text = models.CharField(max_length=200)
>
>     def __str__(self):
>         return self.word_text
>
>
> class Translation(models.Model):
>     #word1 belongs to one word
>     word1 = models.OneToOneField(Word, on_delete=models.CASCADE, 
> related_name="Translation_word1")
>     #word2 belongs to another word
>     word2 = models.OneToOneField(Word, on_delete=models.CASCADE, 
> related_name="Translation_word2")
>
>
>
>
> I want the admin page for Translation to be able to take in two words and two 
> languages and create a translation from them (rather than individually 
> creating one word, then individually creating another word, then indiviudally 
> creating a translation)
>
> I've tried using TranslationForm(models.ModelForm), however when I submit it 
> gives me an error that there are NULL values for my models :C. Help I am 
> really lost and no one has been of help, I'm getting really frustrated with 
> this aspect of django.
>
> If someone could take time to actually understand my problem and help out 
> that would be great please :C
>
> --
> 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/9ab72b11-b7b3-4c1a-bf26-3ed4befb212f%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/9ab72b11-b7b3-4c1a-bf26-3ed4befb212f%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%2B5VyNZOT2-Hp2i2yC_MO7R73P%2BBiDoP%3D%3DrX-aiy35THfxO%3Dw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to