I'm new to packaging apps for external users, so I've been trying to
generalize something from a site of mine. I have a bunch of questions
about best practices that I thought you might have good input on.
It's an app to support "like" and "bookmark" of any object in your
system (I realize there are many flavors of this in the wild). The
code is https://github.com/cgthayer/test/tree/master/django-userlinks
* Examples: is there a canonical example app that covers enough ground
to be _the_ "best practices" example?
* Examples templates: I include a eg_urls.py and
templates/eg/index.html so that people could bring it up and try it
out under a standalone test project. Is there a common way to do
this?
* Ajax: Turns out that I only ever implemented ajax methods in this
app, and they're all in views.py. I see other projects sometimes use
ajax.py or api.py, would that be better?
* Code style: All my ajax functions have an "_ajax" suffix, is there a code
style standard for django? This isn't discussed in http://bit.ly/2n4TDj3
* Implementation: For the app, I wanted to be able to like / bookmark
any object in the system. Some folks use an abstract model mixin
which creates a new table for every model that needs "like" support.
I just create a single UserLink Model with a generic foreign field
(and ContentType) instead. Is there a best practice around this?
* Dependencies: I have a small amount of JS which depends on JQuery,
animateCss, and Font Awesome. Is there a standard way to express
these dependencies or should this be somehow simplified / ripped
out.
* JS.html: I have some templates which generate javascript which
include some {% url %} lookups. Is this acceptable, or is generated
js from templates a bad idea.
* Using apps: I found the workflow quite painful because I'm putting
the app in github but my project is actually in a different repo
(public vs private). To manage this I have 3 directories --is there
a better way?
* work/test/django-userlinks: the bits in github
* work/private_project/private_project: part of a private repo,
has a symlink "userlinks" to "../../test/django-userlinks"
* work/stubproj: how I test my app to be sure it works standalone,
has a symlink "userlinks" to "../test/django-userlinks"
Thanks for any input,
/charles
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/4d697e71-8e2d-4dbb-a58d-643025cb8252%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment