I prefer to store the actual value in database in many cases instead of an
assigned numerical or other representation so I find myself doing this:
color_choices = [(c,c) for c in ["red", "blue", "green"]]
It's not a difficult work-around but I would love to see Django accept a 1
dimensional list
To me having the two mutually-exclusive arguments sounds too much like
trying to fake static typing in a dynamic language. I don't see the
advantage of separate names for basically the same information provided in
different ways. If it walks like a duck...
if callable(upload_to):
self.upload_t
e
path and filename using os.path.split.
my_file = models.FileField(upload_to=get_file_path)
def get_file_path(obj, filename):
return "%s/%s/%s" % (datetime.now.strftime("%Y/%m/%d"), obj.id,
filename)
- Justin
On 10/28/07, Marty Alchin <[EMAIL PROTECTED]> wrote:
>
&
Any reason not to have upload_to accept a string OR a callable and function
accordingly?
Justin
On 10/27/07, Robert Coup <[EMAIL PROTECTED]> wrote:
>
>
> Presumably filename is optional, so only people who actually care will
> use it... with that in mind, personally I'd save the back-compat
> hass