Fahad Hussain
Fahad Hussain

Reputation: 285

Django admin integer field with '+' '-' on either side to increment/decrement value

Im stuck in a client's requirement. He wants to have a field in django admin panel like the screenshot I have attached screenshot

I have a field in my model landing_page_btn_text_size = models.CharField(verbose_name=_("Button Text Size"), max_length=255, default="20px")

Now he want if i click '-' it subtracts 1 from the value and if '+' it adds 1 to the value.

Any help would be appreciated, thanks.

Upvotes: 1

Views: 133

Answers (1)

Jorn
Jorn

Reputation: 26

Django automatically includes this on an IntegerField. One way to include this, is to add in px to the verbose_name and change the model it to an IntegerField.

Upvotes: 1

Related Questions