Skip to content

Commit a16fd5e

Browse files
committed
Merge pull request justinmayer#9 from philb61/master
Don't override manager if it's in the arguments.
2 parents fb62460 + f6d1a12 commit a16fd5e

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

autoslug/fields.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,9 @@ def deconstruct(self):
244244
if self.always_update:
245245
kwargs['always_update'] = self.always_update
246246

247+
if 'manager' in kwargs:
248+
del kwargs['manager']
249+
247250
return name, path, args, kwargs
248251

249252
def pre_save(self, instance, add):

autoslug/tests/tests.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,12 @@ def test_autoslug_with_manager_name(self):
241241
b = NonDeletableModelWithUniqueSlug.objects.create(name='My name')
242242
self.assertEqual(b.slug, u'my-name-2')
243243

244+
def test_deconstruct_with_manager(self):
245+
a = SharedSlugSpace(name='TestName')
246+
a.save()
247+
_, _, _, kwargs = a._meta.get_field('slug').deconstruct()
248+
self.assertNotIn('manager', kwargs)
249+
244250

245251
class AutoSlugModelTranslationTestCase(TestCase):
246252

0 commit comments

Comments
 (0)