liuyang1520 / django-command-extensions

Automatically exported from code.google.com/p/django-command-extensions
MIT License
0 stars 0 forks source link

AutoSlugField populate_from support for multiple fields #84

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
With the current version of AutoSlugField, populate_from only accepts a
string corresponding to a single field.  I've made very small modifications
to the field so it can accept not only a single field name, but a tuple or
list of field names used to populate the slug.  The patch is fully
backwards compatible.

Original issue reported on code.google.com by dave.robert.martin@gmail.com on 9 Mar 2009 at 5:19

Attachments:

GoogleCodeExporter commented 8 years ago
couple of requests:

1) could you please create a patch (diff -uh) for this ? or at the very least 
upload
the full file so it's easier to spot the differences.

2) please use isinstance(self._populate_from, (list, tuple)) instead if type() 
equals.

3) could you make it so that it uses 1 variable name 'populate_fields' instead 
of two
names for basically the same thing. 

the case in which there is only one populate_from field is the same as an N list
case. the only difference is not to add the seperator.

self.separator.join([slugify(getattr(model_instance, field)) for field in
populate_fields])

should work nicely for any number of fields.

thanks in advance ! would love to get this patch in as soon as possible.

Original comment by v.oostv...@gmail.com on 30 Mar 2009 at 10:16

GoogleCodeExporter commented 8 years ago
just a little bumb.
i think there still some small stylish issues open for this.

specifically the re-add commit in your git repository.
sorry to get stuck on this, but if you could fix that by making it one commit 
in a
fresh fork or a patch file, I will commit it to the master repository as soon as
possible.

Original comment by v.oostv...@gmail.com on 16 Apr 2009 at 5:25

GoogleCodeExporter commented 8 years ago
also see:
http://github.com/django-extensions/django-extensions/issues/#issue/1

Original comment by v.oostv...@gmail.com on 17 Apr 2009 at 7:13

GoogleCodeExporter commented 8 years ago

Original comment by v.oostv...@gmail.com on 17 Apr 2009 at 5:50