choicefield
Django ModelChoiceField using distinct values from one model attribute
so I\'m working on a django application where I have a model Event. Each Event has some attributes, say one of them is \"hostname\" (which I will use throughout as an example). I need to implement sea[详细]
2023-03-20 19:02 分类:问答In Django forms.ModelChoiceField HOWTO restrict displayed choices but set one of the restricted values during cleanup
I have a custom field which subclasses ModelMultipleChoiceField. I provide the choices to be displayed via queryset parameter. This queryset excludes certain values. My problem comes when during clean[详细]
2023-03-19 11:01 分类:问答Django ChoiceField: Fail to access choices in template
after trying for hours I m frustrated with this. I just can\'t loop over my ChoiceField\'s choices in the template. It will not even enter the loop. But if 开发者_JAVA技巧I access the form field with[详细]
2023-03-18 23:25 分类:问答Django forms choicefield automatically generated choices
I have a form (forms.Form) that automatically generates the choices for its own choicefield as such: class UserForm(forms.Form):[详细]
2023-03-05 04:32 分类:问答Python - Django - Form choicefield and cleaned_data
I\'m having an issue with how cleaned_data seems to work. I want to store the cleaned_data in a session so I can repopulate the form object later. The problem is my choice fields seems to store the di[详细]
2023-02-20 00:38 分类:问答Django choicefield iniital value problem
I have a dynamic choice field: PASSENGER_TYPE_CHOICE = [(p.id, p.cabin.name) for p in flight.passengertype_set.all() if p.availableSeats > 0][详细]
2023-02-14 00:50 分类:问答Custom unicode on already created object
I\'m using permissions in my application. And in some case I need to create form only with permission field. I\'m using ModelChoiceField and queryset with permission objects.[详细]
2023-01-06 16:20 分类:问答cleaned_data() doesn't have some of the entered data
I have a simple form for a user to enter in Name (CharField), Age(IntegerField), and Sex(ChoiceField). However the data that is taken from the Sex choice field is not showing up in my cleaned_data().[详细]
2023-01-02 13:10 分类:问答How to let the user choose between typing price inclusive VAT or exclusive VAT in TextField?
I am implementing an back-office application where the user type in prices for products. Sometimes it is preferred to type the price inclusive value-added-tax, VAT and sometimes exclusive VAT.[详细]
2022-12-24 11:00 分类:问答List display names from django models
I have an object: POP_CULTURE_TYPES = ( (\'SG\',\'Song\'), (\'MV\', \'Movie\'), (\'GM\', \'Game\'), (\'TV\', \'TV\'),[详细]
2022-12-23 19:58 分类:问答