Error: 'Select a valid choice. That choice is not one of the available choices.'
Closed this issue · 6 comments
Hi @hengage,
The model looks OK. Based on the error you receive I speculate there is an issue with how you are rendering a form in your website. Is this correct?
In the admin site it should display a dropdown list for the to pick an ArticleContent
, since it's a relation field. Can you confirm this as well?
Hey @parisk, from your explanation it seems like I have to select an already existing article. Am i right?
What I am trying to achieve with it is to make it like a text field so I can write my content and post. Just like RichTextField() does.
I guess I just have to use RichtextField and increase its height with CSS. Which I already did btw.
If you intend to store long-form content (e.g. an article's body) in the database, I suggest you use a separate model and reference it with a ForeignKey. It will result in significantly lighter queries, when you SELECT
multiple records.
In that case you would need to create the body
model first and then create the post
model, so you can reference the body
model.
Inline formsets1 might also be of help here.
Footnotes
Alright @parisk I'll create an issue for it on my project and look into it going forward. Thank you.
If you would like to see the finished work when it's in production I can send you the link.
Thanks for the help.
Great. Absloutely look forward to it when I put the project out live.
It's a blog app I am making to put out contents by me and few friends who are writers.