Skip to content

Commit

Permalink
Merge pull request #9 from philb61/master
Browse files Browse the repository at this point in the history
Don't override manager if it's in the arguments.
  • Loading branch information
neithere committed May 5, 2016
2 parents fb62460 + f6d1a12 commit a16fd5e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions autoslug/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,9 @@ def deconstruct(self):
if self.always_update:
kwargs['always_update'] = self.always_update

if 'manager' in kwargs:
del kwargs['manager']

return name, path, args, kwargs

def pre_save(self, instance, add):
Expand Down
6 changes: 6 additions & 0 deletions autoslug/tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,12 @@ def test_autoslug_with_manager_name(self):
b = NonDeletableModelWithUniqueSlug.objects.create(name='My name')
self.assertEqual(b.slug, u'my-name-2')

def test_deconstruct_with_manager(self):
a = SharedSlugSpace(name='TestName')
a.save()
_, _, _, kwargs = a._meta.get_field('slug').deconstruct()
self.assertNotIn('manager', kwargs)


class AutoSlugModelTranslationTestCase(TestCase):

Expand Down

0 comments on commit a16fd5e

Please sign in to comment.