Re: FieldError at /ajouter_centre Cannot resolve keyword 'name' into field. Choices are: categorie, centredeformation, date_de_crea, id

2023-09-26 Thread Baye SALIOU DIAW
J'ai finalement résolu le problème. Merci bien!! Le lundi 25 septembre 2023 à 20:35:25 UTC, Muhammed Lawal a écrit : > Have you confirmed there is a 'name' field in your CentreCategorie and > Region models? > > On Mon, 25 Sep 2023, 5:44 p.m. Baye SALIOU DIAW, > wrote: > >> def

Re: FieldError at /ajouter_centre Cannot resolve keyword 'name' into field. Choices are: categorie, centredeformation, date_de_crea, id

2023-09-25 Thread Muhammed Lawal
Have you confirmed there is a 'name' field in your CentreCategorie and Region models? On Mon, 25 Sep 2023, 5:44 p.m. Baye SALIOU DIAW, < bayesalioudiawt...@gmail.com> wrote: > def ajouterCentre(request): > form = FormCentre() > regions = Region.objects.all() > centrecategories =

Re: FieldError at /ajouter_centre Cannot resolve keyword 'name' into field. Choices are: categorie, centredeformation, date_de_crea, id

2023-09-25 Thread Dino P.Russe
Si tu pouvais aussi envoyer le code du modèle et du formulaire, je pense bien que ton problème sera très rapidement Le lun. 25 sept. 2023 à 19:44, Baye SALIOU DIAW < bayesalioudiawt...@gmail.com> a écrit : > def ajouterCentre(request): > form = FormCentre() > regions =

FieldError at /ajouter_centre Cannot resolve keyword 'name' into field. Choices are: categorie, centredeformation, date_de_crea, id

2023-09-25 Thread Baye SALIOU DIAW
def ajouterCentre(request): form = FormCentre() regions = Region.objects.all() centrecategories = CentreCategorie.objects.all() if request.method == 'POST': categorie_name = request.POST.get('categorie') categorie, created =

Re: Django Resolve Choices Class

2023-08-31 Thread Sebastian Jung
Thank you it is working. Wonderful Andréas Kühne schrieb am Do., 31. Aug. 2023, 20:03: > If you want the string instead of the value, you just use: > entity.get_gender_display() > > Django automatically adds these "magic methods" when you have fields that > have

Re: Django Resolve Choices Class

2023-08-31 Thread Andréas Kühne
If you want the string instead of the value, you just use: entity.get_gender_display() Django automatically adds these "magic methods" when you have fields that have choices. You can see this in the documentation: https://docs.djangoproject.com/en/4.2/ref/models/fields/#choice

Django Resolve Choices Class

2023-08-30 Thread sebasti...@gmail.com
I have in my model.py: class GendersChoices(models.IntegerChoices): M = 0, _('Male') F = 1, _('Female') N = 2, _('Gender Neutral') class Address(models.Model): gender = models.PositiveSmallIntegerField(choices=GendersChoices.choices, blank=True, default=GendersChoices.F, null=True

Don't pass a "set" object in the choices argument for a model field

2023-03-07 Thread Tj Johnson
I just ran into this, a field will accept a "set" object for the choices argument, however since set objects are unordered, it's possible that a new migration will be created every single time makemigrations is run. debugging this was a matter of noticing that the developer used cur

Re: How to use choices in model field

2022-11-04 Thread Aaryan R Soni
')) >>> >>> On Wed, Nov 2, 2022, 5:52 PM Aaryan R Soni >>> wrote: >>> >>>> Hey guys, i am facing some issues using choices in models.CharField. I >>>> am creating a model which has username and status, where status is my >>>> cho

Re: How to use choices in model field

2022-11-02 Thread kateregga julius
;>> >>> On Wed, Nov 2, 2022, 5:52 PM Aaryan R Soni >>> wrote: >>> >>>> Hey guys, i am facing some issues using choices in models.CharField. I >>>> am creating a model which has username and status, where status is my >>>> cho

Re: How to use choices in model field

2022-11-02 Thread Lloyd Leckenby
@gnu.ac.in>> wrote: > Hey guys, i am facing some issues using choices in models.CharField. I am > creating a model which has username and status, where status is my choice > field. it has 2 values, 'Unverified' and 'Verified'. > > class user_stutus(models.Model): &g

Re: How to use choices in model field

2022-11-02 Thread kateregga julius
2 PM Aaryan R Soni >> wrote: >> >>> Hey guys, i am facing some issues using choices in models.CharField. I >>> am creating a model which has username and status, where status is my >>> choice field. it has 2 values, 'Unverified' and 'Verified'. >>>

Re: How to use choices in model field

2022-11-02 Thread Julio Cojom
gt;> Don't use square blackest [ ] >> >> status_choices=(('Unverified','Unverified'),('Verified','Verified')) >> >> On Wed, Nov 2, 2022, 5:52 PM Aaryan R Soni >> wrote: >> >>> Hey guys, i am facing some issues using choices in models.CharField. I >&g

Re: How to use choices in model field

2022-11-02 Thread Aaryan R Soni
est [ ] > > status_choices=(('Unverified','Unverified'),('Verified','Verified')) > > On Wed, Nov 2, 2022, 5:52 PM Aaryan R Soni > wrote: > >> Hey guys, i am facing some issues using choices in models.CharField. I am >> creating a model which has username and status, where status is my

Re: How to use choices in model field

2022-11-02 Thread kateregga julius
Don't use square blackest [ ] status_choices=(('Unverified','Unverified'),('Verified','Verified')) On Wed, Nov 2, 2022, 5:52 PM Aaryan R Soni wrote: > Hey guys, i am facing some issues using choices in models.CharField. I am > creating a model which has username and status, where status

How to use choices in model field

2022-11-02 Thread Aaryan R Soni
Hey guys, i am facing some issues using choices in models.CharField. I am creating a model which has username and status, where status is my choice field. it has 2 values, 'Unverified' and 'Verified'. class user_stutus(models.Model): status_choices=[('Unverified','Unverified'),('Verified

Choices as nav link

2022-02-10 Thread gregory adomako
I have a book model with choices I want to display the choices in the nav bar where upon clicked, will display all the books in with that choice Thanks! -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this grou

Multiple Choices as Label

2022-02-02 Thread sebasti...@gmail.com
Hello, I want in Listview on left side a filterform, where i can filter after sizes and/or colors. This are Multiple Choices Fields. I have attached a image where this fields are shown. For example XS has Key 1 and XL Key 2 and Color Black have Key 1 then i want when user clicks on size XS,XL

Feedback about #27471 (Make admin's list_filter choices collapsable)

2022-01-18 Thread Marcelo Galigniana
Hello everyone! I just pushed a patch about making the django admin filters collapsables when they have more than 10 options inside I would like to read your opinions! Here there is the PR: https://github.com/django/django/pull/15331 Thank you! Marce. -- You received this message because

choices = django background color

2021-11-20 Thread Jonathas Matos
HOICES = ( ('Pendente', format_html('Pendente')), ('AGuardando', format_html('Aguardando')), ('Resolvido', format_html('Resolvido')), ) status = models.CharField(max_length=10, choices=STATUS_CHOICES, blank=False, null=False) Alguém pode me ajudar? -- You received this m

Re: django-admin doesn't display choices and it's not possible to select one

2021-09-22 Thread bnmng
>>> author = models.ManyToManyField(Author) >>>> journal = models.ForeignKey(Journal, models.CASCADE) >>>> summary = models.TextField(max_length=1000, null=True, blank=True, >>>>help_text="B

Re: django-admin doesn't display choices and it's not possible to select one

2021-09-22 Thread Mariangeles Mendoza
journal = models.ForeignKey(Journal, models.CASCADE) >>> summary = models.TextField(max_length=1000, null=True, blank=True, >>> help_text="Brief description of the >>> article") >>> >>> P

Re: django-admin doesn't display choices and it's not possible to select one

2021-09-21 Thread Mariangeles Mendoza
ummary = models.TextField(max_length=1000, null=True, blank=True, >>help_text="Brief description of the >> article") >> >> PUB_TYPE = ( >> ('r', 'refereed'), >> ('t', 'technical report'), >> (

Re: django-admin doesn't display choices and it's not possible to select one

2021-09-20 Thread bnmng
ll=True, blank=True, >help_text="Brief description of the > article") > > PUB_TYPE = ( > ('r', 'refereed'), > ('t', 'technical report'), > ('p', 'proceeding'), > ('b', 'book'), >

django-admin doesn't display choices and it's not possible to select one

2021-09-13 Thread Mariangeles Mendoza
), ('c', 'book chapter'), ) status = models.CharField(max_length=1, choices=PUB_TYPE, default='refereed', help_text='publication type') class Meta: ordering = ['year'] def get_absolute_url(self): return reverse('arti

Re: CHOICES

2021-06-13 Thread Nikeet NA
dels import Sum > > ModelName.objects.filter(field_name__isnull=True).aggregate(Sum('field_name'))# > returns {'field_name__sum': 1000} for example > > > Am So., 13. Juni 2021 um 12:04 Uhr schrieb www.forum-gh.com < > lada...@gmail.com>: > >> Hello friends >> pl

Re: CHOICES

2021-06-13 Thread Sebastian Jung
gt; Hello friends > please i have: conversion_fqctor = models.charfield(choices=FACTOR) > > i want to sum the conversion_factor inside my view.py how do i convert it > to a decimal and use the Sum() > > -- > You received this message because you are subscribed to the Google

CHOICES

2021-06-13 Thread www.forum-gh.com
Hello friends please i have: conversion_fqctor = models.charfield(choices=FACTOR) i want to sum the conversion_factor inside my view.py how do i convert it to a decimal and use the Sum() -- You received this message because you are subscribed to the Google Groups "Django users&q

Re: Limit the choices for a ForeignKey

2020-10-11 Thread Dvs Khamele
t; I need to filter the choices for a foreign key. > > My Model has an attribute SEX that could be M or F, and two Foreign keys ( > FATHER and MOTHER ), I want both filtered for sex. > > How can I achieve it? > > Thanks in advance > > -- > You received this message because

Re: Limit the choices for a ForeignKey

2020-09-27 Thread RANGA BHARATH JINKA
Hi, Check this. This may be useful for you. It is based on dependent dropdown. https://www.youtube.com/watch?v=U_qPp6vPl-g On Sun, Sep 27, 2020 at 10:09 PM Marco Paradisi wrote: > Hi Everyone! > > I need to filter the choices for a foreign key. > > My Model has a

Limit the choices for a ForeignKey

2020-09-27 Thread Marco Paradisi
Hi Everyone! I need to filter the choices for a foreign key. My Model has an attribute SEX that could be M or F, and two Foreign keys ( FATHER and MOTHER ), I want both filtered for sex. How can I achieve it? Thanks in advance -- You received this message because you are subscribed

Re: forms.ChoiceField calls choices callback twice?

2020-08-27 Thread Roy Smith
Hmmm, maybe related to https://code.djangoproject.com/ticket/26665 ? On Thursday, August 27, 2020 at 5:29:39 PM UTC-4 Roy Smith wrote: > I'm running: > > Python 3.7 > Django 2.2 > Debian 4.9 > > If I configure a forms ChoiceField with a callback function for choices, > i

forms.ChoiceField calls choices callback twice?

2020-08-27 Thread Roy Smith
I'm running: Python 3.7 Django 2.2 Debian 4.9 If I configure a forms ChoiceField with a callback function for choices, it gets called twice each time I render the form: > from unittest import TestCase > from django import forms > > def callback(): > print("callback&q

how to override options of choices in django model form

2020-07-28 Thread Sujata Aghor
Hello All, How can I override options of choices in django model form from the model field ? Below is my code - *models.py:* class XXX(models.Model): StatusType = models.TextChoices('StatusType', const.status_values) status = models.CharField(max_length=100, default='abc', choices

Re: Populate choices from existing values in a model field

2020-06-23 Thread Patrick Carra
I'm not directly modifying any code in a .py file I am simply adding a value to the database table but I am unable to see the change reflected in my drop down lists until I restart the server. Is there a better way of populating choices for my drop down menu? Or could I simply add a cron job

Re: Populate choices from existing values in a model field

2020-06-20 Thread Integr@te System
Hi Patrick, Plz review for your suitable case: https://stackoverflow.com/questions/3742734/django-restart-server-or-httpd Nice. On Sat, Jun 20, 2020, 1:32 AM Patrick Carra wrote: > I am trying to read distinct values from a model field and use the tuple > list to populate the c

Populate choices from existing values in a model field

2020-06-19 Thread Patrick Carra
I am trying to read distinct values from a model field and use the tuple list to populate the choices in a Form. The problem I have is that every time a new value is added I must reset the httpd server in order to include the new value in the form. I have researched and tried this a few

Re: Models as choices

2020-04-17 Thread Esther Camilo
, Gavin Wiener wrote: >>>> >>>> Couldn't the User just have a ForeignKey on countries? >>>> >>>> On Thursday, April 16, 2020 at 12:52:07 PM UTC+8, shreehari Vaasistha L >>>> wrote: >>>>> >>>>> how can i

Re: Models as choices

2020-04-17 Thread Denilson Antonio Avellan
Couldn't the User just have a ForeignKey on countries? >>> >>> On Thursday, April 16, 2020 at 12:52:07 PM UTC+8, shreehari Vaasistha L >>> wrote: >>>> >>>> how can i use model x values as choices for model y ? >>>> >>>> fo

Re: Models as choices

2020-04-17 Thread Gavin Wiener
: >> >> Couldn't the User just have a ForeignKey on countries? >> >> On Thursday, April 16, 2020 at 12:52:07 PM UTC+8, shreehari Vaasistha L >> wrote: >>> >>> how can i use model x values as choices for model y ? >>> >>> for eg: >>

Re: Models as choices

2020-04-16 Thread shreehari Vaasistha L
rsday, April 16, 2020 at 12:52:07 PM UTC+8, shreehari Vaasistha L > wrote: >> >> how can i use model x values as choices for model y ? >> >> for eg: >> class countries(models.Model): >> country = models.CharField(max_length=200) >> >>

Re: Models as choices

2020-04-16 Thread Gavin Wiener
Couldn't the User just have a ForeignKey on countries? On Thursday, April 16, 2020 at 12:52:07 PM UTC+8, shreehari Vaasistha L wrote: > > how can i use model x values as choices for model y ? > > for eg: > class countries(models.Model): > country = models.CharField(max_le

Re: Models as choices

2020-04-16 Thread shreehari Vaasistha L
Thanks for helping me out . On Thursday, April 16, 2020 at 2:34:13 PM UTC+5:30, Kasper Laudrup wrote: > > Hi Shreehari > > On 16/04/2020 10.17, shreehari Vaasistha L wrote: > > Object of type ValueError is not JSON serializable > > > > > > getting this above error > > > > First of all,

Re: Models as choices

2020-04-16 Thread Kasper Laudrup
Hi Shreehari On 16/04/2020 10.17, shreehari Vaasistha L wrote: Object of type ValueError is not JSON serializable getting this above error First of all, don't highjack other unrelated threads. Create your own with a descriptive subject. You get the error because of the lines: except

Re: Models as choices

2020-04-16 Thread shreehari Vaasistha L
, April 16, 2020 at 12:57:16 PM UTC+5:30, Antje Kazimiers wrote: > > with a Foreign Key field, one-to-many relationship: > > https://docs.djangoproject.com/en/3.0/topics/db/examples/many_to_one/ > > Antje > On 4/16/20 6:52 AM, shreehari Vaasistha L wrote: > > how can i us

Re: Models as choices

2020-04-16 Thread shreehari Vaasistha L
e/ > > Antje > On 4/16/20 6:52 AM, shreehari Vaasistha L wrote: > > how can i use model x values as choices for model y ? > > for eg: > class countries(models.Model): > country = models.CharField(max_length=200) > > def __str__(self): > return self.country

Re: Models as choices

2020-04-16 Thread Antje Kazimiers
with a Foreign Key field, one-to-many relationship: https://docs.djangoproject.com/en/3.0/topics/db/examples/many_to_one/ Antje On 4/16/20 6:52 AM, shreehari Vaasistha L wrote: > how can i use model x values as choices for model y ? > > for eg: > | > classcountries(models.Mod

Models as choices

2020-04-15 Thread shreehari Vaasistha L
how can i use model x values as choices for model y ? for eg: class countries(models.Model): country = models.CharField(max_length=200) def __str__(self): return self.country class User(AbstractUser): """User model.""" username = None full_name =

Re: Study on annotation of design and implementation choices, and of technical debt

2020-03-23 Thread Motaz Hejaze
are interested > in investigating the protocol used by developers while they have to > annotate implementation and design choices during their normal development > activities. More specifically, we are looking at whether, where and what > kind of annotations developers usually us

Study on annotation of design and implementation choices, and of technical debt

2020-03-23 Thread Alexander Serebrenik
Dear all, As software engineering research teams at the University of Sannio (Italy) and Eindhoven University of Technology (The Netherlands) we are interested in investigating the protocol used by developers while they have to annotate implementation and design choices during their normal

Django formset, forms passing unique choices into a choicefield for each form

2019-12-18 Thread Brad Allgood
Initially posted on stack overflow: https://stackoverflow.com/questions/59395761/passing-dynamic-choices-into-a-formset-unique-for-each-form I am working on what I thought was a simple college football confidence pool. The concept is as follows: - Bowl Model: Model that stores information

How to create choices/options on the web page

2019-06-18 Thread mollyx09
I've been trying to create a list of options/choices for the user to choose from to display different types of graphs(bar/line etc) on the web page based on the same data that has been previously entered by me. I couldn't find very useful information online to go about this. Could you please

how to update choices of field in change_view

2019-04-18 Thread richard . wu . 03
hi There, I have a field named A which has default choices, but when some filed named B was changed, i need to update the choices of filed A. I have tried overried function get_form, formfield_for_choice_filed, none of them could update choice of A based on value of filed B. Any help would

Filtering choices in a form based on previous field selection

2019-04-07 Thread Gavin Boyle
PITCH_TYPE = ( ('1', 'Outdoor'), ('2', 'Indoor'), ) pitch_size = models.CharField(max_length=1, choices=PITCH_SIZES) pitch_type = models.CharField(max_length=1, choices=PITCH_TYPE) open_time = models.TimeField(default='09:00') close_time = models.TimeField(default='22:00')

Re: Trying to filter out choices in a form based on the logged in user.

2019-02-09 Thread Ricardo Cataldi
r[1], >> place__gte=user.location_filter[0]) >> >> >> >> I have not tested this solution, but with some minor code changes it >> should work like a charm in filtering the club queryset. >> >> >> >> *From:* django...@googlegroups.com *On &

Re: Trying to filter out choices in a form based on the logged in user.

2019-02-09 Thread GavinB841
location_filter[0]) > > > > I have not tested this solution, but with some minor code changes it > should work like a charm in filtering the club queryset. > > > > *From:* django...@googlegroups.com < > django...@googlegroups.com > *On Behalf Of *GavinB841 > *Se

RE: Trying to filter out choices in a form based on the logged in user.

2019-02-09 Thread Ricardo Cataldi
To: Django users Subject: Trying to filter out choices in a form based on the logged in user. Hi all, If anyone could help or point me in the direction of some documentation for the below problem I am having I would really appreciate it. Just to explain quickly: 1. I have a model called

Trying to filter out choices in a form based on the logged in user.

2019-02-09 Thread GavinB841
Hi all, If anyone could help or point me in the direction of some documentation for the below problem I am having I would really appreciate it. Just to explain quickly: 1. I have a model called "Team" which contains a foreign key to another model called "Club" 2. The "Club" model

how to aasign id on forms.py and how to generates choices on the form of another models for individual id ,choices may be differenet for individual id

2019-01-29 Thread Suzan Bajracharya
=forms.CheckboxSelectMultiple, choices=opt) amount=forms.IntegerField(label='Amount',initial="0") p_date=forms.widgets.DateTimeInput(attrs={'type':'date'}) # p_date = forms.DateTimeField(label='Purchase-Date', widget=forms.DateTimeInput(attrs={'type':'date'})) class Meta: model=Medical_Meds exclude

Re: Using reflection with Django models to determine module containing the choices?

2018-12-10 Thread Stodge
Thanks Simon. It's for an offline tool so high performance isn't the top priority. On Monday, 10 December 2018 11:56:53 UTC-5, Simon Charette wrote: > > Given choices are defined at the module level I guess you could > iterate over objects defined in each `sys.modules` (or the ones

Re: Using reflection with Django models to determine module containing the choices?

2018-12-10 Thread Simon Charette
Given choices are defined at the module level I guess you could iterate over objects defined in each `sys.modules` (or the ones likely to define choices) and use the `is` operator to compare all of them to the field choices. This will perform badly and shouldn't be used for anything else than one

Using reflection with Django models to determine module containing the choices?

2018-12-10 Thread Stodge
, 'Sophomore'), (JUNIOR, 'Junior'), (SENIOR, 'Senior'), ) year_in_school = models.CharField( max_length=2, choices=YEAR_IN_SCHOOL_CHOICES, default=FRESHMAN, ) But instead I want to do: from student_app import choices

Re: using a foreign key with multiple choices

2018-11-13 Thread Jani Tiainen
frequently having your current structure is okayish. Just make a name field in Categorie model as free text. 'Christian' via Django users kirjoitti ti 13. marrask. 2018 klo 14.45: > Hello > > I need to use a model form to create a new instance of Recette, using > multiple choices

Re: using a foreign key with multiple choices

2018-11-13 Thread amit pant
use dict in * LISTE_CHOIX.* On Tue, Nov 13, 2018 at 6:14 PM 'Christian' via Django users < django-users@googlegroups.com> wrote: > Hello > > I need to use a model form to create a new instance of Recette, using > multiple choices list instead of the foreign_key > > *cl

using a foreign key with multiple choices

2018-11-13 Thread 'Christian' via Django users
Hello I need to use a model form to create a new instance of Recette, using multiple choices list instead of the foreign_key /class Recette(models.Model):// //  ..// //    categoriederecette = models.ForeignKey(Categorie, on_delete=models.CASCADE) // / /class Categorie(models.Model

Re: How to filter choices in Django2's autocomplete_fields?

2018-08-29 Thread ciaran . courtney
Not possible ATM it seems, pity https://code.djangoproject.com/ticket/29010 -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to

Re: How to filter choices in Django2's autocomplete_fields?

2018-08-29 Thread ciaran . courtney
You need to override ModelAdmin.get_search_results() as per https://docs.djangoproject.com/en/2.1/ref/contrib/admin/#django.contrib.admin.ModelAdmin.autocomplete_fields My problem is I override ForeignKeyField in AdminForm, where I can filter based on self.instance, this is not possible in

Django model's field dynamic choices

2018-05-14 Thread Marcin
I'm using Django 1.11. I cannot set dynamic choices for model's field because: - choices must be iterable, not function, - choices iterable is always coverted to list, - iterable is evaluated oat the module import stage. The whole thing is about iterable evaluation time. The data

Re: How do I get dynamic choices to a select widget at render time?

2018-02-22 Thread Mike Dewhirst
the the answer form is instantiated ... class AnswerSingleForm(forms.ModelForm): class Meta: model = Answer fields = [ 'answer', 'score' ] So how do I get that set of choices into the Answer form? I can see

Re: How do I get dynamic choices to a select widget at render time?

2018-02-20 Thread Andy
> 'score' > ] > > So how do I get that set of choices into the Answer form? > > I can see from the docs that the form Meta class can have a widgets > attribute for the 'answer' field. I think I need a ChoiceField widget so > I can include the choi

Re: How do I get dynamic choices to a select widget at render time?

2018-02-20 Thread Mike Dewhirst
):     def __init__(self, *args, **kwargs):     super(AnswerSingleForm, self).__init__(*args, **kwargs)     answer = kwargs['instance']     choices = answer.question.get_choices()     if len(choices) > 0:     self.fields['answer'] = forms.ChoiceField(     choi

How do I get dynamic choices to a select widget at render time?

2018-02-19 Thread Mike Dewhirst
is instantiated ... class AnswerSingleForm(forms.ModelForm):     class Meta:     model = Answer     fields = [     'answer',     'score'     ] So how do I get that set of choices into the Answer form? I can see from the docs that the form Meta class can have a widgets attribute

Re: How to do "choices" from DB in form field without breaking migrations and such

2018-02-15 Thread C Kirby
Yeah, I meant to write about that. If you put a database filter in a field definition (model or form) it only runs it on start/restart. Using the method I put, or a callback function in the choices, allows the choices to reflect reality of the data. On Thu, Feb 15, 2018 at 12:24 PM, <jason

Re: How to do "choices" from DB in form field without breaking migrations and such

2018-02-15 Thread jasonbnance
, 2018 at 9:54:24 AM UTC-6, C. Kirby wrote: > > You can set the choices in the form __init__ to handle the issue: > > class FooJBossForm(Form): > biz_service = MultipleChoiceField( > choices=[], > required=False, > label='Business Service', >

Re: How to do "choices" from DB in form field without breaking migrations and such

2018-02-15 Thread C. Kirby
You can set the choices in the form __init__ to handle the issue: class FooJBossForm(Form): biz_service = MultipleChoiceField( choices=[], required=False, label='Business Service', widget=SelectMultiple(attrs={'class': 'form-control'}), ) def __init__

Re: How to do "choices" from DB in form field without breaking migrations and such

2018-02-15 Thread jasonbnance
-6, jason...@gmail.com wrote: > > Hello everyone, > > I have a form field that is pulling choices from the database: > > class FooJBossForm(Form): > biz_service = MultipleChoiceField( > choices=BizService.objects.filter( > biz_unit__bu_name=

How to do "choices" from DB in form field without breaking migrations and such

2018-02-15 Thread jasonbnance
Hello everyone, I have a form field that is pulling choices from the database: class FooJBossForm(Form): biz_service = MultipleChoiceField( choices=BizService.objects.filter( biz_unit__bu_name='Foo', ).order_by('bs_name').values_list('bs_name', 'bs_name').distinct

How to filter choices in Django2's autocomplete_fields?

2018-01-08 Thread Oren
In Django 2.0, autocomplete_fields was added, which is great. Without autocomplete_fields, I can change the queryset of a ForeignKeyField using formfield_for_foreignkey

Re: MultipleChoiceField records down choices as a list, but CharField converts them to a list?

2017-10-30 Thread James Schneider
; > property_type = models.CharField(max_length=50, help_text="You can > select more than 1 option") > > > *forms.py:* > property_type = forms.MultipleChoiceField(widget=forms.SelectMultiple, > choices=BuyerListing.PROPERTY_TYPE) > > > Let's assume the s

Re: Building a search form with 4 required choices, which will be inserted as arguments in an URL [warning: long question]

2017-10-29 Thread Jack
. Thanks Daniel! On Sunday, October 29, 2017 at 7:59:25 AM UTC-4, Daniel Roseman wrote: > > On Monday, 23 October 2017 16:59:36 UTC+1, Jack wrote: >> >> This is a semi-long question. Please let me know wherever I make a >> mistake. >> >> I'm building a se

Re: Building a search form with 4 required choices, which will be inserted as arguments in an URL [warning: long question]

2017-10-29 Thread Daniel Roseman
On Monday, 23 October 2017 16:59:36 UTC+1, Jack wrote: > > This is a semi-long question. Please let me know wherever I make a > mistake. > > I'm building a search form with 4 required choices, 1 of the choices is a > CharField with a max_length of 3. The other 3 choices

Re: Possible Bug Regarding model choices and form hidden input?

2017-10-28 Thread Jani Tiainen
l > > On Sat, Oct 28, 2017 at 6:01 AM, Etienne Robillard <tkad...@yandex.com> > wrote: > >> Which Python and Django versions do you use? >> >> Etienne >> >> Le 2017-10-27 à 23:27, Paul Kenjora a écrit : >> >> Hi, >> >&

Re: Possible Bug Regarding model choices and form hidden input?

2017-10-28 Thread Paul Kenjora
> Hi, > > When setting HiddenInput on a form widget for an integer model field > with choices, in tests I get 'X is not a valid choice' errors. I'm > guessing it's the hidden input returning a STRING and the model expecting > an INT. > > I have a model that has >

Re: Possible Bug Regarding model choices and form hidden input?

2017-10-28 Thread Etienne Robillard
Which Python and Django versions do you use? Etienne Le 2017-10-27 à 23:27, Paul Kenjora a écrit : Hi,   When setting HiddenInput on a form widget for an integer model field with choices, in tests I get 'X is not a valid choice' errors.  I'm guessing it's the hidden input returning

Possible Bug Regarding model choices and form hidden input?

2017-10-27 Thread Paul Kenjora
Hi, When setting HiddenInput on a form widget for an integer model field with choices, in tests I get 'X is not a valid choice' errors. I'm guessing it's the hidden input returning a STRING and the model expecting an INT. I have a model that has *class Banner(models.Model

MultipleChoiceField records down choices as a list, but CharField converts them to a list?

2017-10-26 Thread Jack
perty_type = forms.MultipleChoiceField(widget=forms.SelectMultiple, choices=BuyerListing.PROPERTY_TYPE) Let's assume the selected choices were 'Condo Apartment' and 'Semi-detached'. The value stored on my database is this - ['Condo Apartment', 'Semi-detached'] Now this is in a list format, which m

Building a search form with 4 required choices, which will be inserted as arguments in an URL [warning: long question]

2017-10-23 Thread Jack Zhang
This is a semi-long question. Please let me know wherever I make a mistake. I'm building a search form with 4 required choices, 1 of the choices is a CharField with a max_length of 3. The other 3 choices are ChoiceField's. Here is a picture of what the search form looks like: <https://

Re: dynamic choices based on another field input.

2017-10-22 Thread Derek
gt; model A(in image) base field. and another field is a drop down box where > the choices should be dynamic based on first field selection. the choices > should all the values of field Os from second model B associated with the > Base key value i have given in first field. > example from

dynamic choices based on another field input.

2017-10-20 Thread rajeev yadla
hi have a form which have two fields. one field has a foreignkey from model A(in image) base field. and another field is a drop down box where the choices should be dynamic based on first field selection. the choices should all the values of field Os from second model B associated

Re: Choices in DecimalField - django 1.8.

2017-09-19 Thread Gordon Wrigley
(TENSAO_110, '110 volts')) > > class Equipamento(models.Model): > nome = models.CharField(max_length=128) > tensao = models.DecimalField(max_digits=8, >decimal_places=3, >choices=TENSOES, >

choices choice utility

2017-05-05 Thread Mike Dewhirst
Because I use many of the same constants in different apps in my project I keep most of them including almost all choices in a single __init__.py file and import them wherever required. Here is a tiny utility I use all the time ... whenever get__display() is inappropriate. def choose

Re: Limiting choices in a lookup by exclusion

2017-02-01 Thread Melvyn Sopacua
length = 32) > > state = USStateField() > > zip = USZipCodeField() > > phone = models.ManyToManyField(Phone, limit_choices_to = > > > > {'type_id':'H'}) > > > > but what I'd like to do is restrict the choices of phone numbers for > >

Re: Limiting choices in a lookup by exclusion

2017-01-31 Thread C. Kirby
null = True) > city = models.CharField(max_length = 32) > state = USStateField() > zip = USZipCodeField() > phone = models.ManyToManyField(Phone, limit_choices_to = > {'type_id':'H'}) > > but what I'd like to do is restrict the choices of phone numbers for >

Limiting choices in a lookup by exclusion

2017-01-31 Thread Gordon R. Burgess
= models.CharField(max_length = 32) state = USStateField() zip = USZipCodeField() phone = models.ManyToManyField(Phone, limit_choices_to = {'type_id':'H'}) but what I'd like to do is restrict the choices of phone numbers for Locations to those that aren't 'C' (cell phones) - I've found some hints

How to make properly choices based on two models?

2016-09-24 Thread Anton Ponomarenko
class Meta: db_table = 'admindivisions_countries_translations' verbose_name = 'Country Translation' verbose_name_plural = 'Countries Translations' # profiles.forms class UserProfileForm(forms.ModelForm): # PREPARE CHOICES country_choices = () lang_group = Lang

Re: choices field language

2016-06-21 Thread Luis Zárate
in https://docs.djangoproject.com/en/1.9/topics/python3/ El martes, 21 de junio de 2016, ludovic coues <cou...@gmail.com> escribió: > Python 3 have a better support of international alphabet. > > 2016-06-20 23:44 GMT+02:00 Xristos Xristoou <saxr...@gmail.com>: >> he

Re: choices field language

2016-06-21 Thread ludovic coues
Python 3 have a better support of international alphabet. 2016-06-20 23:44 GMT+02:00 Xristos Xristoou <saxr...@gmail.com>: > hello i want to use choices in my field but not work if i write in my > language(greek) only work in the england language. > if i writing choices in my l

choices field language

2016-06-20 Thread Xristos Xristoou
hello i want to use choices in my field but not work if i write in my language(greek) only work in the england language. if i writing choices in my language show me error message in the admin mode (this choose is not valid),any idea how to fix that ?i have python 2.7 -- You received

Re: FieldError: Cannot resolve keyword u'domain' into field. Choices are: children, content, date_create, date_update, domain__associations, id, level, lft, name, parent, parent_id, rght, tree_id, use

2016-05-17 Thread Michal Petrucha
On Tue, May 17, 2016 at 05:58:51AM -0700, François GUÉRIN wrote: > Thanks very very very much ! You're welcome. (-: On Tue, May 17, 2016 at 05:56:23AM -0700, François GUÉRIN wrote: > Argh !! It works ! We could use double underscores in relation names, > before, no ? I don't think so – if it

Re: FieldError: Cannot resolve keyword u'domain' into field. Choices are: children, content, date_create, date_update, domain__associations, id, level, lft, name, parent, parent_id, rght, tree_id, use

2016-05-17 Thread François GUÉRIN
Thanks very very very much ! Le mardi 17 mai 2016 14:51:05 UTC+2, Michal Petrucha a écrit : > > On Tue, May 17, 2016 at 05:44:24AM -0700, François GUÉRIN wrote: > > Hi all, > > > > I'm a django application dev for a few years, so I'm pretty familiar > with > > it. I have a problem with a new

  1   2   3   4   5   6   7   8   9   >