Skip to content

Conversation

@andresp99999
Copy link
Contributor

@andresp99999 andresp99999 commented Nov 8, 2019

Hello, I have the following use case:

a) I have an object with a string field (uuid) that is stored in a 36 character field.
b) I want to use django-clone to create copies of it (including the uuid), however the current implementation append the UNIQUE_DUPLICATE_SUFFIX field and hence the value is larger than the max field size and the save() call fails.

This PR adds a class variable USE_UNIQUE_DUPLICATE_SUFFIX to disable this behavior.

)
if not str(value).isdigit():
value += ' {} {}'.format(cls.UNIQUE_DUPLICATE_SUFFIX, count)
if cls.USE_UNIQUE_DUPLICATE_SUFFIX is True:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this check use ?

if cls.USE_UNIQUE_DUPLICATE_SUFFIX:
    ...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, done.

@jackton1 jackton1 merged commit a3c409c into tj-django:master Nov 9, 2019
@jackton1
Copy link
Member

jackton1 commented Nov 9, 2019

@all-contributors please add @andresp99999 for bugs.

@allcontributors
Copy link
Contributor

@jackton1

I've put up a pull request to add @andresp99999! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants