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

Cleanup, example and overall improvements to django-threadedcomments #39

Merged
merged 33 commits into from
Mar 1, 2013
Merged

Conversation

vdboor
Copy link
Collaborator

@vdboor vdboor commented Jun 3, 2012

Hi,

I've been looking into getting django-threadedcomments up to date, with clean examples. I hope you accept this first series of changes. It contains:

  • An example app
  • Fixes when deleting parent comments
  • A render_comment_list tag and get_comment_count so that {% load comments %} can be replaced by {% load threadedcomments %}
  • South migrations
  • ...and overall cleanups of the code.

These were all parts I missed in the application, and I hope it saves other peoples time too.
Thanks for your time to include these changes.

Diederik

yurtaev and others added 30 commits June 1, 2011 17:15
Seems like a neat thing to do before merging code.
- fixes deleting a parent when deleting the last child.
- checks for the 'for' keyword in the template tag.

Conflicts:
	threadedcomments/migrations/0001_initial.py
	(South 0.7.4 with Django 1.4 generates different frozen models)
Also include a warning that South 0.7.4 (current version) does not
recognize the on_delete=SET_NULL option yet.
Synced settings with 1.4 defaults, to include staticfiles and new
template loader definitions. Made adjustments to be 1.3 and 1.4 compatible;
- excluded LOGGING configuration, which differs between 1.3 and 1.4
- and included the ADMIN_MEDIA_PREFIX
Use context processors, jQuery from a CDN (avoid inclusion just for the
example), and cleaned up JavaScript with 'cancel reply' function.
Split templates to base.html and home/message.html
Can't remember seeing someone behind a VT100 terminal for a very long time..  ;-)
Considering that 2.5 is even unsupported, other projects dropped it much
sooner last year, and even Django dropped it in 1.4, it's about time.

Using new @decorator syntax now.
Had a hard time understanding the code, improved that.
- Include syntax examples in if-statements.
- Add docstrings for the `annotate_tree` and `fill_tree` filters.
The code operates just like the version of `django.contrib.comments`,
and also supports the `flat` and `root_only` flags like
`get_comment_list` does.

With these 2 tags, the `{% load comments %}` tag is swappable
with `{% lad threadcomments_tags %}`
Allow to be used by any `get_whatever` node
Copied `get_object` / `get_form` logic from django.contrib.comments.
Keeping inline example as separate template.
This is required to let the default absolute URL of Comment work.
This is what the example app is for after all :-)
@csrf_protect
def message(request, id):
context = {
'message': Message.objects.get(id=id),
Copy link
Owner

Choose a reason for hiding this comment

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

Could you do get_object_or_404 here please

@honzakral
Copy link
Owner

wow, thanks a lot! I have planned on doing a tiny sprint on threadedcomments this Tuesday so this is absolutely perfect.

I will add a few comment on the code on what I spot, but overall it looks very good.

Thanks!

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(os.path.dirname(__file__), 'sampledb.db'),
Copy link
Owner

Choose a reason for hiding this comment

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

better than including a sqlite file would be providing some fixtures so peaple can use whatever (also no git conflicts etc)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good point. Didn't consider the possible conflicts. I've added a example-data.json.
I did find it convenient, most Django apps lack an example making it hard to evaluate them.
Just having to do a download + runserver was a breeze to get a good preview.

Nicely suggested by @honzakral in the comments of pull #39
Avoids git conflicts and allow testing other databases faster.
Nice suggestion by @honzakral in git pull #39
@vdboor
Copy link
Collaborator Author

vdboor commented Jun 3, 2012

...great to know the timing was that good, and the work in appreciated :-)
Looking forward to any other suggestions, and I'm curious what sprint you have planned. :-)

@honzakral
Copy link
Owner

well, we are having a little django sprint here in Prague, but since tickets have been piling up here I thought I would invest some effort into cleaning things up, your work is a great help.

@kvbik
Copy link
Collaborator

kvbik commented Jun 5, 2012

hey, thx for this huge amount of work. it looks like you invested a lot of time into this project.

i am willing to merge this stuff soon, but right now, i will test it in our production. if this integration test pass, lets make it a release, ok?

before that i have to check what version actually is on pypi..

can i have one {prosbu} for you? next time you want us to pull something, just split it to more pull requests - i understand we are way behing with new stuff - but it is way easier to check and commit smaller changes.

thx again, looking forward for more cleanup and features from you ;))

@vdboor
Copy link
Collaborator Author

vdboor commented Jun 6, 2012

Seems like a good plan, especially the testing and making a release as well. :-)

I'll keep my pull requests smaller next time. This was indeed a massive sprint to get things into shape, I don't think such big change is needed in the future.

If you have any specific feature plans in mind, please add them to the README. It's always nice to know where a project is heading to, and I'll keep the invitation in mind ;-)

@vdboor
Copy link
Collaborator Author

vdboor commented Jul 9, 2012

Hi, did you find time to merge the pull request back in? I was hoping to see a release on pypi :-)

@kvbik
Copy link
Collaborator

kvbik commented Jul 12, 2012

hey @vdboor - sorry, i didn't have anymore time. but we actually had another small sprint on tuesday. we finally have access to pypi, so right now, we will release current version there and your changes will follow asap.

@vdboor
Copy link
Collaborator Author

vdboor commented Jul 12, 2012

hi @kvbik, thanks for the follow up! This is great news to hear!

@honzakral
Copy link
Owner

sorry guys, I don't use MySQL so I haven't had a chance to test it properly, I will get right on it.

@johanneswilm
Copy link

@honzakral: ok, very cool!

@honzakral honzakral merged commit 6ea6b25 into honzakral:master Mar 1, 2013
@honzakral
Copy link
Owner

This is merged, Thanks a lot and sorry for the delay

pombredanne pushed a commit to pombredanne/django-fluent-contents that referenced this pull request Nov 6, 2013
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.

None yet

8 participants