-
Notifications
You must be signed in to change notification settings - Fork 197
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
allow to make comments for non-abstract models by COMMENTS_FOR_CONCRETE_MODEL setting #177
base: master
Are you sure you want to change the base?
Conversation
Would you be able to write a test for that? |
@claudep OK, I will get to it. |
@claudep I just bumped into this and realized that I forgot to finish it. |
I would love to get a quick second review by someone else (maybe @felixxm ?). I think some documentation may still be needed. |
tests/testapp/models.py
Outdated
author = models.ForeignKey(Author, on_delete=models.CASCADE) | ||
headline = models.CharField(max_length=100) | ||
|
||
def save(self, *args, **kwargs): | ||
import pudb; pudb.set_trace() |
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.
oops :-)
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.
Sorry :-D Fixed.
I fixed the useless code and added some basic documentation. |
content_type=ContentType.objects.get_for_model( | ||
self.target_object, | ||
for_concrete_model=COMMENTS_FOR_CONCRETE_MODEL, | ||
), |
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'm not sure if the new setting is the preferred way 🤔 What do you think about adding the for_concrete_model=True
keyword argument to the get_comment_object()
and get_comment_create_data()
?
@felixxm I have rewritten the code to use the I will probably use the COMMENTS_FOR_CONCRETE_MODEL for Another way to support this would be to have some mapping in settings like |
@felixxm I taught about it more, and I came up with new approach to my problem: #188 That said, this PR is contains little change to the core code and can solve different use-cases where using proxy models is needed. |
I have implemented functionality that I need in #188, however this might be helpful in different use cases so I converted it to draft. |
It's looks good now. |
@blockchainGuru1018 Could you please rather review #188. I converted this to draft in case someone wants to take this work over and adapt it for his/hers purposes. Overridable model keys are solving my use-case much better. |
Reviewed your PR @PetrDlouhy |
No description provided.