I'm a little new to django.
I would like to display multiple models in one admin view in django.
when I do this:

admin.site.register(Language)
admin.site.register(Word)
admin.site.register(Translation)


b

It would register 3 different models.

My models look like this (this is for a dictionary app by the way):


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 = models.OneToOneField(Word, on_delete=models.CASCADE, 
related_name="Translation_word1")
    word2 = models.OneToOneField(Word, on_delete=models.CASCADE, 
related_name="Translation_word2")

    def __str__(self):
        return self.word1.word_text


I would like it to have an admin view where you would INPUT two words in a text 
box, choose the languages from a dropdown and click save, and it would create a 
translation for those words.



 How do I go about doing this?

-- 
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/a1feef39-bc6c-4b07-b43e-7e60deb48bfe%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to