Maybe using a Model like Kurtis mentioned will be better (and easier) than
making a custom field... ?
Le jeudi 23 août 2012 18:49:55 UTC+2, Michael Palumbo a écrit :
>
> I did not know the pickle module. This is interesting. Thanks.
> However, after playing with it, I am not sure it fits
I did not know the pickle module. This is interesting. Thanks.
However, after playing with it, I am not sure it fits totally my need
because I'd like humans to be able to write a string like
"modulea.moduleb.MyClass" in the admin or so.
So I kept trying making a custom field (instead of a
On 23-8-2012 0:37, Michael Palumbo wrote:
> ok thanks, so you'd rather do it with a Model than a custom field.
> I actually started to make a custom field but I had a few issues while
> displaying it in the admin so that's why I asked the question then.
You can pickle an object and store the
ok thanks, so you'd rather do it with a Model than a custom field.
I actually started to make a custom field but I had a few issues while
displaying it in the admin so that's why I asked the question then.
Le jeudi 23 août 2012 00:16:48 UTC+2, Kurtis a écrit :
>
> Whoops,
>
> foo =
Whoops,
foo = property(get_reference, set_reference)
should be
reference = property(get_reference, set_reference)
Sorry, was reading another page to make sure I have the property code right:
http://stackoverflow.com/questions/1454727/do-properties-work-on-django-model-fields
On Wed, Aug 22,
It looks like you want to, basically, store a reference to a Python object
in your Model. It shouldn't be too extremely difficult. I'd create a Model
for this purpose though and just use extra methods to provide any
functionality you need. Just as a quick prototypical example:
class
Hi,
Do you know a custom field for a callable python object like a Class or a
function ?
It could store it as a string in the DB: "module1.module2.class" or
"module1.module2.function"
With that string, it could load it as a real python object when you get it
from the DB.
For example, you
7 matches
Mail list logo