-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add duplication on objects #3212
Conversation
Test summaryRun details
View run in Cypress Dashboard ➡️ This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard |
Codecov ReportBase: 98.23% // Head: 98.23% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## master #3212 +/- ##
=======================================
Coverage 98.23% 98.23%
=======================================
Files 291 291
Lines 20778 20848 +70
=======================================
+ Hits 20412 20481 +69
- Misses 366 367 +1
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest :
- use duplicate only in detail view with button, not in list views (avoid problems)
- unpublished publishable instances
- duplicate attachments / attachments accessibility WITH document duplication (avoid problem if document deleted by a duplicate attachment)
geotrek/common/mixins/models.py
Outdated
obj.pk = None | ||
obj.uuid = uuid.uuid4() | ||
if 'name' in [field.name for field in self.__class__._meta.get_fields()]: | ||
obj.name = f'{self.name} (copy)' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
obj.name = f'{self.name} (copy)' | |
obj.name = f'[_("Copy")] {self.name}' |
geotrek/common/mixins/models.py
Outdated
# Duplicate the object and save it. | ||
obj.id = None | ||
obj.pk = None | ||
obj.uuid = uuid.uuid4() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
obj.uuid = uuid.uuid4() | |
obj.uuid = None |
I think that with default value uuid is automaticaly generated (to verify)
geotrek/common/mixins/models.py
Outdated
for obj in sub_objects: | ||
# Duplicate the object and save it. | ||
obj.id = None | ||
obj.pk = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use pk or id. pk is an alias to id. I suggest to only change pk
ec6837e
to
263cd4c
Compare
d8392c8
to
bcb1d97
Compare
bcb1d97
to
cb09854
Compare
325caf8
to
f8656cb
Compare
838aca1
to
6c561d5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice job !
@@ -26,6 +26,7 @@ class PhysicalEdgeList(CustomColumnsMixin, CreateFromTopologyMixin, MapEntityLis | |||
|
|||
|
|||
class PhysicalEdgeFormatList(MapEntityFormat, PhysicalEdgeList): | |||
mandatory_columns = ['id', 'physical_type'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it related to duplicate ?
f050424
to
8999182
Compare
No description provided.