Skip to content
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

Comment merge methods #1298

Open
koeaw opened this issue Oct 17, 2024 · 1 comment
Open

Comment merge methods #1298

koeaw opened this issue Oct 17, 2024 · 1 comment
Labels
documentation Improvements of or additions to documentation – project docs, docstrings, code comments

Comments

@koeaw
Copy link
Contributor

koeaw commented Oct 17, 2024

I think it would be helpful to add docstrings, if brief ones, to the merge methods in AbstractEntity.

Specifically:

def get_merge_view_url(self):

and:

def merge_with(self, entities):

The fact the former looks like it mirrors the duplicate method's implementation but not its name pattern throws an additional wrench into trying to infer what's what a glance.

def get_duplicate_url(self):

@koeaw koeaw changed the title Comment merge functions Comment merge methods Oct 17, 2024
@koeaw koeaw added the documentation Improvements of or additions to documentation – project docs, docstrings, code comments label Oct 17, 2024
@koeaw
Copy link
Contributor Author

koeaw commented Oct 17, 2024

Ok, the duplicate method's name seems to follow the pattern of most methods in GenericModel, which also has some with "view" in their names.

def get_importview_url(cls):
ct = ContentType.objects.get_for_model(cls)
return reverse("apis_core:generic:import", args=[ct])
def get_edit_url(self):
ct = ContentType.objects.get_for_model(self)
return reverse("apis_core:generic:update", args=[ct, self.id])
def get_enrich_url(self):
ct = ContentType.objects.get_for_model(self)
return reverse("apis_core:generic:enrich", args=[ct, self.id])

Not sure if the word is meant to differentiate between different types of actions/views, but what I said above about it adding an element of confusion remains unchanged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements of or additions to documentation – project docs, docstrings, code comments
Projects
None yet
Development

No branches or pull requests

1 participant