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

2018-02-15 Thread jasonbnance
Thank you very much. This worked perfectly. Consequently it also fixed my issue of those select boxes not reflecting changes in the list until the web server was restarted since the data is now being pulled at instantiation instead of in the class definition. j On Thursday, February 15, 201

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

2018-02-15 Thread jasonbnance
I should have included that the reason I'm using a `MultipleChoiceField` instead of a `ModelMultipleChoiceField` here is because I want the POSTed variable to be the business service name (string) not the primary key of the selected record. j On Thursday, February 15, 2018 at 8:56:56 AM UTC-6

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(

Re: Troubleshooting Constraint Already Exists

2018-02-09 Thread jasonbnance
I was able to work around the issue by dumping out the SQL for the migration that was failing (manage.py sqlmigrate ...) and running through the steps manually (skipping the "already exists" constraints) and finally marking the migration as completed (with a --fake). j On Friday, February 9,

Troubleshooting Constraint Already Exists

2018-02-09 Thread jasonbnance
Hello all, I'm using 1.11 and have a migration that is throwing: django.db.utils.ProgrammingError: constraint "inventory_ltmvirtualserver_ltm_id_47dc1635_fk" for relation "inventory_ltmvirtualserver" already exists I'm having troubles figuring this out for a couple reasons. First, the migrat