On Thu, 29 Jun 2017, Guilherme Leal wrote:
"An iterable (e.g., a list or tuple) consisting itself of iterables of
exactly two items"
I don't think that constructing choices as a "iterableof 1 item iterables"
will work.
Think of each item in the choices iterables as a key-value pair, where the
"An iterable (e.g., a list or tuple) consisting itself of iterables of
exactly two items"
I don't think that constructing choices as a "iterableof 1 item iterables"
will work.
Think of each item in the choices iterables as a key-value pair, where the
first item is the key (literally is the value
On Thu, 29 Jun 2017, Guilherme Leal wrote:
It wouldn't be the case to use the field choices?
https://docs.djangoproject.com/en/1.11/ref/models/fields/#django.db.models.Field.choices
Guilherme,
Now that I know Field.choices exists it will certainly do the job.
I read the example as transl
It wouldn't be the case to use the field choices?
https://docs.djangoproject.com/en/1.11/ref/models/fields/#django.db.models.Field.choices
2017-06-29 18:07 GMT-03:00 Rich Shepard :
> On Wed, 19 Apr 2017, Mike Dewhirst wrote:
>
> Second, I have a couple of fields with postgres check constraints;
On Wed, 19 Apr 2017, Mike Dewhirst wrote:
Second, I have a couple of fields with postgres check constraints; that
is, valid data is restricted to a list of strings. I've not found a
Django model field validator teaching me how to write this.
Use the model's clean() method ...
https://docs.dja
On Fri, 21 Apr 2017, Michal Petrucha wrote:
If you want to be able to gracefully handle violations of those
constraints, and produce more meaningful error messages (for example, when
validating a form that processes one of these models), you'd also
implement those checks in Python, either in you
Hi Rich,
On Fri, Apr 21, 2017 at 05:48:01AM -0700, Rich Shepard wrote:
> What about my other question? When I want to limit acceptable strings in a
> data entry field to a provided list, as in postgres's check constraint? Is
> Mike's suggestion of clean() the way to handle these?
As far as I kn
On Fri, 21 Apr 2017, Michal Petrucha wrote:
For the foreseeable future, though, I'd strongly recommend that you save
yourself a lot of trouble, and just add a surrogate primary key field to
all your tables and models.
Michal,
I'll let Django do this. However, should I still specify unique_t
On Fri, 21 Apr 2017, Michal Petrucha wrote:
I have bad news for you – Django does not at this point in time have
support for multi-column primary keys. A large part of the ORM is built
around the assumption that each model instance is identified by a single
field acting as its primary key.
Mic
On Tue, Apr 18, 2017 at 03:13:24PM -0700, Rich Shepard wrote:
> Converting from the postgres schema to a Django models.py for my first
> Django project. Most of the syntax (64 lines in the file) should be correct,
> but there are two conditions that I have not found how to handle.
>
> First, a
Rich
I've run out of time this week. Maybe someone else can help.
Mike
On 21/04/2017 11:45 AM, Rich Shepard wrote:
On Fri, 21 Apr 2017, Mike Dewhirst wrote:
In the more usual scenario you specify your models using Python and
let the Django ORM framework do the SQL. If that is your case ...
On Fri, 21 Apr 2017, Mike Dewhirst wrote:
In the more usual scenario you specify your models using Python and let the
Django ORM framework do the SQL. If that is your case ...
Mike,
I wrote the schema for postgres but had not created the database. So I
renamed the file models.py and convert
On 21/04/2017 7:48 AM, Rich Shepard wrote:
On Wed, 19 Apr 2017, Mike Dewhirst wrote:
You probably need a single FK plus a meta option of unique_together
https://docs.djangoproject.com/en/1.8/ref/models/options/#unique-together
Mike,
Okay. What would be the correct syntax for
PRIMARY KEY
On Wed, 19 Apr 2017, Mike Dewhirst wrote:
You probably need a single FK plus a meta option of unique_together
https://docs.djangoproject.com/en/1.8/ref/models/options/#unique-together
Mike,
Okay. What would be the correct syntax for
PRIMARY KEY unique_together=('company', 'person', 'proj_nb
On Wed, 19 Apr 2017, Mike Dewhirst wrote:
You probably need a single FK plus a meta option of unique_together
https://docs.djangoproject.com/en/1.8/ref/models/options/#unique-together
Use the model's clean() method ...
https://docs.djangoproject.com/en/1.8/ref/models/instances/#django.db.mode
On 19/04/2017 8:13 AM, Rich Shepard wrote:
Converting from the postgres schema to a Django models.py for my first
Django project. Most of the syntax (64 lines in the file) should be
correct,
but there are two conditions that I have not found how to handle.
First, a couple of classes have p
Converting from the postgres schema to a Django models.py for my first
Django project. Most of the syntax (64 lines in the file) should be correct,
but there are two conditions that I have not found how to handle.
First, a couple of classes have primary keys with three fields. I know
there's
17 matches
Mail list logo