I am building a dictionary translation app that translates from one language to another, and I would like for the admin to be able to enter in two words, and their associated languages, these two words would, then get stored as a translation. Currently there is no way of doing this (Inline doesn't work, I tried, maybe someone could help?) so I would like a form that isn't associated with any models. I do, however want to preform actions on the form after the user has submitted, the actions would create a translation model object. How would i go about creating an admin form that isn't associated with a model.
-- Here is what my models look like:
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, one word can have many translations | |
word1 = models.ForeignKey(Word, on_delete=models.CASCADE, related_name="Translation_word1") | |
#word2 belongs to another word, one word can have many translations | |
word2 = models.ForeignKey(Word, on_delete=models.CASCADE, related_name="Translation_word2") |
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 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/dc67c657-685c-4fac-b7d1-7ed4a680e2bb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment