Improved uuid slug for untitled snipt, and fix new flag.
parent
fc087b7a14
commit
3266bfd3f6
|
@ -494,6 +494,7 @@
|
|||
success: function(model, response) {
|
||||
$('button.save, button.save-and-close, button.delete, button.cancel',
|
||||
window.site.$main_edit).removeAttr('disabled');
|
||||
that.model.set('new_from_js', false);
|
||||
},
|
||||
error: function(model, response) {
|
||||
if (response.responseJSON) {
|
||||
|
|
|
@ -12,7 +12,10 @@ def slugify_uniquely(value, model, slugfield="slug"):
|
|||
|
||||
while True:
|
||||
if suffix:
|
||||
if value:
|
||||
potential = "-".join([base, str(suffix)])
|
||||
else:
|
||||
potential = str(suffix)
|
||||
if not model.objects.filter(**{slugfield: potential}).count():
|
||||
return potential
|
||||
suffix = str(uuid.uuid4()).split('-')[0]
|
||||
|
|
Loading…
Reference in New Issue