withlogicco/django-prose

Error: 'Select a valid choice. That choice is not one of the available choices.'

Closed this issue · 6 comments

I have this error when I try to make a post: "Select a valid choice. That choice is not one of the available choices."

image

Is this some sort of error from my end? Or from django-prose?

here is my model

image

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

  1. https://docs.djangoproject.com/en/4.1/topics/forms/modelforms/#inline-formsets

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.

We could actually add a Real world usage12 in the README to indicate products using Django Prose. That would be great.

Footnotes

  1. https://github.com/xtermjs/xterm.js#real-world-uses

  2. https://github.com/sourcelair/ceryx#real-world-uses

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.