-
Notifications
You must be signed in to change notification settings - Fork 162
refactor commentbox_props() into classmethod to allow better overriding #372
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
Conversation
b74ab2e
to
cbed69d
Compare
cbed69d
to
7653462
Compare
Thank you @PetrDlouhy. Maybe you want to consider sending the same changes (and modifying the existing tests for the frontend.py module) to django-comments-ink. It's still under development, but at some point it will supersede django-comments-xtd. |
@danirus Thanks for merging and improving my PR. I will look at the Should I re-post my PRs from here also to I polished #342, so please merge that, I will look at the other rests later. |
Thanks for the offer of the Svelte plugin, but I have very little spare time. It would nice if you made it open source and people could install it with npm or yarn. :-) In django-comments-ink the major differences with -xtd are that:
I'm adding more features at the speed of a snail. It would be great if you could bring there the changes you suggested about using UUIDs for comment PKs. I remember that it had little explanation, it looked like a hack. If you don't want to spend time writing literature, do you have an open public repository using django-comments and django-comments-xtd with UUIDs to illustrate the case? I will look into #342 at the end of the week. |
@DeniRus Using UUIDs as PKs itself is almost no problem with current implementation. The only change needed are few forgotten What is more challenging is setting comment URLs to non-PK field, which is needed if you want to add UUID to current model which is using IDs and don't want to rewrite half of the application and end up in migration hell. I don't have public implementation, but I can transform the code into documentation or sample application. I might also try to explore more another solution - to have settings with field mappings. Something like: COMMENTS_ID_OVERRIDES = {
'Article': 'my_uuid_field',
'Item': 'another_id_field',
} But I must say, that I did dive into that before, and I was not able to implement it. One of the reason is, that it did require many modifications also at the side of |
@danirus I have completed that taught in django/django-contrib-comments#188 and #374. |
I am using the
commentbox_props()
function in my app to create my own comment view.I wanted to restrict the queryset in this function to show correct number of comments (not counting comments private to user).
With this slight change of the
commentbox_props()
function into classmethods I am able to do this without need of copying of the entire code of the function.