Jay P.
Jay P.

Reputation: 2590

How to make radio buttons in Django admin

Does Django itself provide radio button models? I was trying to find out how to make radio buttons in Django admin, but since there is nothing related to that, It seems like Django doesn't have radio buttons as default.

Upvotes: 0

Views: 1895

Answers (2)

ZaherSarieddine
ZaherSarieddine

Reputation: 126

This is too late but could be useful for other you can define the radio button in your admin like this:

radio_fields = {'gender': admin.VERTICAL}

Upvotes: 2

hassan
hassan

Reputation: 185

Django model with choices will make use of select by default. To use radio buttons, you will have to to use the RadioSelect widget. See django docs

Upvotes: 1

Related Questions