Django disqus startup - python

Well I guess that most of Django developers are aware of the fact that the default Django's comment system is deprecated and no longer supported, so now ive decided to go for a reliable system such as disqus to handle my website's commenting system but there are several obstacles I need to solve before being able to make it functional(using Django-disqus plugin):
(The scenario is that the user leaves a comment for an article published by another user, and consequently, the user receiving the comment should be able to see all of the comments left by users for his articles in his profile section as well as being able to moderate them, something like a social website)
first of all it asks for API_KEY and whatever guide ive read for obtaining one is no longer valid(it looks like that disqus has a little shift in their strategy regarding api keys)
another is the fact that the Django package repo description says that the plugin supports moderation but I cant find it anywhere
and lastly, I also need to find a way to either store the comments locally or use remote queries to filter out comments in each profile section properly, or maybe there is another way that slipped my mind?
if the disqus plugin is not suitable for this situation, a suggestion for another Django plugin for comments handling and moderation with a tutorial is also welcome.
BTW the python version is 3.4 and Django version is 1.8, (both stable)

Related

django oscar and djangocms

I am interested in combining django-cms for content management and django oscar for e-commerce.
Can someone give me some direction, preferably someone that has already successfully combined the two:
[A] Should the structure be a base oscar site, with the oscar templates modified to insert the necessary placeholders to permit cms etc...,
OR
[B] Should the structure be a base django-cms site, with oscar being handled by plugins etc...
My gut feeling is that it should be [A], but please correct me if I am wrong.
Any other suggestions would be appreciated, as there is little online, and I have written to the author of oscar with no response. I am aware of THIS link, which doesn't address implementation, only comparing compatibilities.
This combination is something that I've been looking at for a while and actually had a working prototype. Without knowing your full use case it's difficult to advise properly.
What I required sounds very similar to you, a site that can have CMS editable pages on the same sub domain (e.g. www.myshop.uk/shop www.myshop.uk/cms-pages) as the oscar provided pages. I wanted to have the initial homepage driven by the CMS and a separate area of the site for the E-commerce pages.
If your requirements are the same as mine, the best way to achieve the integration is via an app hook in Django CMS, this would mean that the CMS is the controlling package: http://docs.django-cms.org/en/release-3.3.x/how_to/apphooks.html
I used the following documentation, the code didn't work on more recent versions of Oscar and CMS but was a good guide of what should be possible and a push in the right direction: https://pypi.python.org/pypi/djangocms-oscar/0.1
I will be attempting this again very soon as I have a new site where the CMS and E-commerce site are separate and need merging under the same sub domain.
Is this still an issue for you?
I am considering either contacting the author about updating the previous project "djangocms-oscar" or creating a new one with supporting docs for others.
I have worked on the very similar configuration you have asked here. A pure blend of django-cms with django-oscar.
Here's what I did and it works perfectly fine.
First setup a new project with cookiecutter-django-cms
Then install django-oscar inside it.
Setup your shop.
As long as I know, it works fine.

Using Django Users for all logged in users, and registering them

I have a site that - other than the signup process - will be only used by logged in users. It's my first Django site, and I'm wondering whether I can use the Django user model (slightly extended) to work with all my users, or should it only be used for administrative users such as myself?
Apologies if this is a stupid question. Additionally, and either way, what's the best way to manage user registrations? It'd be awesome if this were built into Django, but it's not, and I read django-registration is relatively abandoned. Any recommendations welcome.
You can use the Django User model for all your users (of course, it all depends on your actual scenario, but it sounds like it could work in your case). You can also extend it (e.g. add more fields): https://docs.djangoproject.com/en/dev/topics/auth/customizing/#extending-the-existing-user-model
Is it the best way to manage users? Again, it depends on the scenario, but it would still work for a significant portion of Django projects.
I read django-registration is relatively abandoned
I haven't used it in a while, but I'd guess it would work with the current Django version. In any case, it's a fairly simple and robust application, so you might be able to tweak it to make it work (you might even decide to commit the changes back to the repo, in the open source spirit).
I was just talking to an advanced developer friend of mine about this. He said using djangos users is frowned upon and to build it out separately. I don't know much more on this but it's something I will be doing in the future.

Huge Django project

I have a new job and a huge django project (15 apps, more than 30 loc). It's pretty hard to understand it's architecture from scratch. Are there any techniques to simplify my work in the beginning? sometimes it's even hard to understand where to find a form or a view that I need... thnx in advance.
When I come to this kind of problem I open up a notebook and answer the following:
1. Infrastructure
Server configuration, OS etc
Check out the database type (mysql, postgres, nosql)
External APIS (e.g Facebook Connect)
2. Backend
Write a simple description
Write its input/output from user (try to be thorough; which fields are required and which aren't)
Write its FK and its relation to any other apps (and why)
List down each plugin the app is using. And for what purpose. For example in rails I'd write: 'gem will_paginate - To display guestbook app results on several pages'
3. Frontend
Check out the JS framework
Check the main stylesheet files (for the template)
The main html/haml (etc) files for creating a new template based page.
When you are done doing that. I think you are much more prepared and able go deeper developing/debugging the app. Good luck.
Use this http://packages.python.org/django-extensions/graph_models.html
to generate the Relationship diagrams from the models so that you can visually see how the models are related to each other. This will give you nice idea about the app
1) Try to install the site from scratch. You will find what external apps are needed for the site to run.
2) Reverse engineer. Browse through the site and try to find out what you have to do to change something to that page. Start with the url, look up in urls.py, read the view, check the model. Are there any hints to other processes?
3) Try to write down everything you don't understand, and document the answers for future reference.
I would clone the project so you can mess up endlessly.
Then I would start to reduce the code. "What happens if if just remove this function here?
Also get django debug toolbar:
https://github.com/django-debug-toolbar/django-debug-toolbar
A good terminal debugger is also golden, there are many out there, here is an example:
https://github.com/tomchristie/django-pdb
This allow you to halt the code and even inject and mutate parameters in runtime. Just like GDB in C.
If you use FireFox you can install FireBug on it and when you for example submit ajax form you can see at which url send you request after what you can easily find controller which work with this form data. At chrome this utility embedded by default and call by F12 key.

Django-cms and Editorial workflows

I need to implement workflows in my Django-CMS application at work. But form the Django-CMS feature list, we can read:
Editorial workflow
Workflows for publishing and approval.
I tried to search for it and didn't find anything. I've search the Django-CMS documentation (http://docs.django-cms.org/en/latest/index.html) and couldn't find something there either.
Does anyone has a clue about Workflows in Django-CMS (especially for the pages system) ?
An update for 2016:
No Editorial Workflow in django CMS 3 (yet)
django CMS 3 (v3.3.2 as of today) has no editorial workflow. This feature was removed in version 2.3, and replaced by the concept of "simple publishing" (2 versions of content: draft, public). Read the related blog post from Divio for their motivation.
For version 3.5 there is some extended moderation support planned via an addon, as explained by Angelo Dini in a current comment on the original blog post from 2012. Don't bet on it, though.
Control over Editing
If what you want is, at least, some control over editing, e.g. "some users are allowed to create and edit only but can't publish changes", then you're in luck. It works as follows:
Control over editing goes with the following formula, it's a combination of 3 things:
"Staff" status + App permissions + CMS permissions
The first two are plain Django concepts (from django.contrib.auth, see the Django docs) and the latter comes from django CMS. All 3 play together, here's why:
Without "Staff" status no editing is allowed at all, no CMS toolbar for front-end editing is shown either. Note that this status cannot be set on a group, it must be set on individual users. (d'oh!)
Without all app permissions (cms, djangocms-, cmsplugin-, zinnia) assigned to the group (or user directly) there is no editing; the CMS toolbar will be shown and you can typically double-click on content to initiate editing, but django CMS will tell you that you have no permission.
Omitting some of the CMS permissions (e.g. create, publish) disables the buttons on the CMS toolbar. That's about it. There is no message instructing the user what to do or explanation about what is happening (acknowledged, it's difficult to provide a generic solution here), neither are emails or other notifications sent (of course, there is no such thing as an editorial workflow).
IOW, it's possible to split your users into groups and allow them to do just some specific things (editing only, publishing only, etc.), but the user notifications, a central concept to workflow implementions, are not available in django CMS v3.3.
EDIT: See "Editorial workflow for django CMS" in the django CMS developers G+ group for details and a demo of a related implementation.
When you turn on CMS_MODERATION in Django-CMS, you will get three icons next to each page in the page list view. From left to right, these control
whether changes to this page will require moderator approval
whether changes to this page's children will require moderator approval
whether changes to this page's descendents will require moderator approval
When you create or change a page, you will be able to save it, and preview the page or new version of the page on your site, but it will require moderator approval before the page or new version of the page is visible to end users.

Multiple-instance Django forum software

Does anyone know of a django forum plugin that allows each member to have his own forum? If there isn't anything, than what would be the best way to accomplish this with a "regular" forum plugin for Django?
I once created a feature matrix of all Django forum apps I could find. It might be a bit outdated now, though (contributions welcome).
At least django-threadedcomments uses generic foreign keys, so you can attach a message thread to any database object, including users.
Look at DjangoBB.
Yep, the forum app of SCT can be used for this - simply set it up and create multiple "community Groups" (these are similar to vhosts) and map them to subdomains - each community group would have separate forum categories, can have separate templates, separate user permissions, etc. (but they will obviously share the same django users and their profiles) - as an example.. the following websites are all hosted on the same instance:
SCT website
My personal website/blog (the blog is also based on SCTs forum)
ShelfShare Community
Check out diamanda. I'm not sure it does what you need as far as the each user having its forums, but that's probably not too hard to hack on top. Probably as simple as adding a few ForeignKeys into auth.User to the diamanda models. In general django pluggables and djangoapps are good places to look for django stuff that is already written. Also, check out pinax.
I believe the Sphene Community Tools can do this.

Categories