Do properties work on Django model fields?
I think the best way to ask this question is with some code… can I do this:
I think the best way to ask this question is with some code… can I do this:
I have a model:
How do you store a “blob” of binary data using Django’s ORM, with a PostgreSQL backend? Yes, I know Django frowns upon that sort of thing, and yes, I know they prefer you use the ImageField or FileField for that, but suffice it to say, that’s impractical for my application.
i’m starting the TDD development attitude and am writting unit-tests for my django application. I’m aware of fixtures and know that’s the way tests should be executed, but for a given test i do need to execute it on the whole database, and json fixture for 10+ million row database is not something i’d like to handle, moreover, this test is “read-only”.
Is there a way to extend the built-in Django Group object to add additional attributes similar to the way you can extend a user object? With a user object, you can do the following:
I have 2 models Task and TaskImage which is a collection of images belonging to Task object.
I have a legacy db table which has composite primary key. I don’t think I will be able to change the structure to include a surrogate key, as there is some code written that uses that table. And in django, I cannot use that table, as it doesn’t have a primary key(non-composite).
I have these models:
I’ve seen a few examples defining choice fields like so:
I’m currently learning Django and some of my models have custom methods to get values formatted in a specific way. Is it possible to use the value of one of these custom methods that I’ve defined as a property in a model with order_by()?