Skip to content

Tag: django

Django – dropdown form with multiple select

I need guidance building a django dropdown forms.Form field in which I can select multiple choices. I need to select multiple locations on the office field of the form. When submitted, the form needs to return a list of the chosen offices (e.g. [“New York”, “Los Angeles”] or [“Au…

model IntegerField() to django-template with ordinal

I have a model with IntegerField() And i would like it to display in a template with ordinal suffix. I would like the floor output like this. 1st, 2nd, 3rd, 4th… 10th.. 12th.. 13th.. 15th… Answer You can use ordinal function from django.contrib.humanize package

How to call super of enclosing class in a mixin in Python?

I have the following code, in Django: Now, I want to use the mixin without blatting the behaviour of the save in Parent. So I when I save, I want to do stuff C, B, and A. I’ve read Calling the setter of a super class in a mixin however I don’t get it and having read the super docs