Questions tagged [django-multiselectfield]

14 questions
1
vote
2 answers

Django - multiselectfiled is not working?

I used Python version 3.11.3 Django version 4.2.3 And I tested multiselectfield in simple project. models.py from django.db import models from multiselectfield import MultiSelectField class Book(models.Model): BOOK_CHOICES = ( …
1
vote
0 answers

Django Multiselect Filed showing List Index Out Of range Error in Window

I was working with Django and it's throwing an error IndexError: list assignment index out of range and the same code is working fine on Linux production, I used pip install django-multiselectfield for multiselect in Django, I am using this DATA=…
1
vote
1 answer

can't access database values of django MultiSelectField in an external script

I have a simple scenario where i have a django multiselectfield and the choices are: jobs_multiple_choice = ( (1, 'Social Media Manager'), (2, 'Online Tutor'), (3, 'Bookkeeper'), (4, 'Personal Trainer'), (5, 'Email Marketer'), …
Muhammad huzaifa
  • 144
  • 2
  • 10
1
vote
0 answers

Django MultiSelectField how to have disabled=True in the form

I am using django MultiSelectField for storing multiple choice fields in db. In my forms.py I make many fields as read only by setting disabled=True: xyz = forms.IntergerField(disabled=True) This doesnt work with MultiSelectField. I tried the…
Aseem
  • 5,848
  • 7
  • 45
  • 69
1
vote
0 answers

Django "TypeError: 'MultiSelectField' object is not iterable" while overriding MultiSelectField choices

I need to create a Django model 'CitiesVisited' with a MultiSelectField that will contain all cities for a given country taken from a JSON file. The saved objects need to look like this: So that for each country ('CitiesVisitedCountry' model), each…
1
vote
1 answer

Django - how to use MultiSelectField in template

I am trying to add MultiSelectField in a django template. I implemented the below code, but there is a problem in the template. However, in django admin it is working perfectly. #models.py from multiselectfield import MultiSelectField class…
1
vote
0 answers

How do I return valid MultiSelectField data in the html file

The results I'm getting is none after it renders the context in the HTML file, but it works fine in the admin panel, any clue why this is happening and how I can solve it models.py GENRE_CHOICES = ( ("1", "Action"), ("2", "Adventure"), …
0
votes
0 answers

Broken migrations after implementing MultiSelectField with choices based on ForeingModel

I'm using MultiSelectField and it works perfect, the problem is when I need to do migrations after my models... class Title(models.Model): name = models.TextField(null = True) degree =…
0
votes
1 answer

how to set a default for multiselect field in django

I have an Account model that extends django's custom User model: class Account(models.Model): user = models.OneToOneField(User, on_delete=models.CASCADE) joined_groups = models.ManyToManyField(Group, related_name='joined_group', blank=True) …
0
votes
3 answers

How to use django-multiselect field in postman?

I am using pip module MultiSelectField Here is my model SALES_CHANNEL = [ ('retailer', 'Retailer'), ('wholesaler', 'Wholesaler'), ('consumer', 'Consumer'), ('distributor', 'Distributor'), ('online', 'Online') ] class…
0
votes
1 answer

Error handling for checked fields Django multiselectfield

I have a conditional check where I need to look at a certain checkbox, and depending on that, a multiselect field becomes required. I have something similar in place: {% for value, text in form.customfield.field.choices %}
Loser Coder
  • 2,338
  • 8
  • 42
  • 66
0
votes
2 answers

Django REST framework - MultiSelectField - TypeError: Object of type 'set' is not JSON serializable

I'm trying to make a multi-choice rest api with Django REST framework and django-multiselectfield. Currently inside the model I have: ANIMAL = ( ('dog', 'Dog'), ('cat', 'Cat'), ) class MyForm(models.Model): ... animals =…
ET-CS
  • 6,334
  • 5
  • 43
  • 73
-1
votes
1 answer

I can't import multiselectfield

I'm trying to use multiselectfield in Django although I installed it with pip install django-multiselectfield and put it in my INSTALLED_APPS but I can't import it in my forms.py file... what can i do?
pedi
  • 13
  • 2
-2
votes
1 answer

Django template language shortens words

I would like to display the language(s) a user chose for his user profile. Everything is working I just can't display the full language name. So when I write {{user.userprofile.language}} the html Output is "English, Spanish, French" but when I…
hansTheFranz
  • 2,511
  • 4
  • 19
  • 35