django nonrel and the admin - django

I am looking to use django non-rel on app engine for an upcoming project and would like to know.
Can I make use of the django admin, to create news articles in django non-rel or do I need to code my own admin?
Or will the standard django admin work?

I'm using django-nonrel, but not the admin.
I don't know the answer for sure, but I'm pretty sure it's possible, since other people have done it.
Django-nonrel works fine as long as you don't use any many-to-many relations. If using many-to-many relations, I really don't know how well dbindexer works. The admin may use many-to-many relations if you use permissions. So depending on what contrib components you're using, you may run into problems.

Related

What functionality is lost when using django with mongodb?

I am evaluating whether I want to use mongoDB with django for my next project. What I am not sure about, though, is what functionality (ORM, admin, forms, etc.) I loose when I use a DB backend that is not officially supported.
I consider using the mongodb-engine.
So, you have Django-mongoadmin and Django-mongonaut for django-admin stuff. Also
Django-mongodbforms for model forms. MongoEngine as ORM. But this modules are pretty raw and unstable so use it with wariness.

Django CMS Draft/Live system for custom model

Django CMS has cool Draft/Live -system related to pages. Does Django CMS support enabling similar functionality for custom models? If it does how to do it?
I'm trying to build news-app, that have models, that have placeholderfield and some other fields.
So, any ideas how to implement draft/live -system for my news-app?
Django-CMS 3.0.0
Django 1.5.5
Unfortunately, the way draft/live system implemented in Django CMS doesn't allow to reuse it on another model. In Django CMS, it is achieved by versioning Page object and maintaining publisher_is_draft and publisher_public properties.
Yet you can't directly reuse Django CMS approach in your app, you can closely reimplement it in your own, better way. Please don't forget to share the sources :)
We actually want that 3rd party apps can have a daft/public version workflow easily... if you could come up with a way to provide that.... please share.

Integrating Django tutorial example Polls app and django-registration

I'm learning Django on Ubuntu 13.04, Python 2.7, Django 1.5, Postgres 9.2,
Bootstrap 3.0. I'd like to achieve a combination of the tutorial example Polls app with django-authentication.
As my first effort I got the Polls app working from the Django 1.5 tutorial. I then installed django-registration 1.0 and these templates to make it work. I chose that package for authentication as opposed to django-allauth as a result of my question on authentication framework.
Now I want to integrate Polls and django-registration to record a set of results per user. After the poll results have been collected the admininstrator uses Django Admin interface to run a script to analyse the results (e.g. compute some statistics) and send an email to a subset of all users.
I briefly looked at two existing projects that looked like could get me there out of the box.
Light Bird's Questionnaire App was too complicated using a custom library of modular class based views. I'd like to keep it as simple as possible, using as much of out-of-the-box Django 1.5 functionality as possible for ease of maintenance and initial design.
Pinax web framework on top of Django, although a great idea, seems to be stuck in dark ages of 2011 with latest code supporting only Django 1.4 and Bootstrap 2.x. Starter projects don't look that useful and documentation isn't flash either.
Based on the above it looks like I'll have to do the integration of Polls and registration manually. At first pass I was thinking roughly the following:
The poll & choice could be simplified down to just a numeric answer to a question.
At database level we would need a separate table.
The primary key would be the userid.
Each column would store one answer per.
I'm guessing this would need a class PollsResults in model.py that would include defining the primary key as User, which should exist via django-registration.
Exactly how to do that and what follows gets a bit hazy to me at the moment.
I'm sure the above is a simple exercise for a Django developer. Could anyone give me some starting hints or even better an existing project that does something similar?
It looks like you're slightly underestimating the power of using a framework such as django. For example, you don't really need to worry too much about tables in the database or what will be their primary keys, because django's Object Relational Mapper (ORM) takes care of a lot of that for you.
If you want to connect two models (database tables) in django you can use a foreignkey like this:
class ThingOne(models.Model):
name = models.CharField(max_length=50)
class ThingTwo(models.Model):
thing_one = models.ForeignKey('ThingOne')
The quotes around 'ThingOne' in my ForeignKey are actually unnecessary because the ThingOne model has already been defined, but I like to use quotes anyway because it means your ForeignKeys will also work for models defined below (in your code) the model linking to them.
You therefore just need to add a relationship between your Polls and User models. If one user might have many poll results you should probably use a ManyToManyField instead of a ForeignKey but the principle is the same. That should be enough to get you started.

Django nonrel Models

I have been looking at the documentation on django nonrel but think i have confused my self.
I have a project using the setup instructions found at http://www.allbuttonspressed.com/projects/djangoappengine#installation and continued to setup a django application. I am making a simple news feed. Now it has come to create the models but there appears to be two ways of doing this, using models.Model or db.Model.
models.Model is the django way of doing it, and if I create a model using this it appears to use nosql, this also allows me use of the built in admin.
db.Models is the non-rel way of doing things. If I create the model using this is appears to use nosql again but this method does not let me make use of the django admin. I thought the point of django non-rel was to let me make use of the admin and a majority of the default functionality in django.
I would also like to ask what is the difference between django non-rel and pure django on app engine and how does this affect how the models are created?
This is incorrect:
db.Models is the non-rel way of doing things
Where did you get this idea? db.Models is the AppEngine way of doing things. django-nonrel allows you to use the Django way even though you're on AppEngine. As you say, the point of django-nonrel is to allow you to use the admin etc, for which you need to do things the Django way, ie models.Model.

Django-nonrel vs Django-mongodb vs Mongokit vs pymongo native

Working on a Django project that requires a NoSQL store and I believe I've settled on Mongo. I've seen a lot of topics that talk about Mongo and Django, but none that mentioned Django-nonrel, and I can't see why it might have been disqualified, but I have no experience with any of them.
Ideally, I'd like to preserve the SQL store for the simple things, user auth, groups, etc., and use Mongo for the bigger data.
I'd also like to have my Mongo-stored objects as classes, in a Django-ORM style, so that I can have a similar 'feel', but that isn't critical.
Lastly, do any of the above allow me to use Django's multi-database support for anything, or are all my mongo queries effectively 'out of band' from the Django ORM?
If there are any other factors I'm missing that might be important, feel free to clue me in. I know little in this arena.
Django-nonrel is the way to go for Django on MongoDB. There's django-mongodb.org, but that's just built on top of Django-nonrel. There's quite a bit of mongodb activity going on the django-nonrel mailing list.
Storing your mongo classes as Django ORM objects works fine, that's the whole point.
I haven't tried using the multi-database support along with SQL. I haven't seen many people use it like that, and I suspect it most likely does not work. There's some work on moving django-nonrel to be officially part of Django 1.4, I suspect it'll work after that's complete.
Using django-nonrel for auth works ok. The main problem is many-to-many relations. The auth module uses that for per user object permissions - that doesn't work. If you don't need that, you could probably get away without using the SQL at all.
Adding onto dragonx answer. The issue with django-nonrel is that the auth module doesn't work.
You can perform many-to-mamy joins using $lookup operator. djongo does automatically for you. It translates SQL syntax into mongodb aggregation queries and populates the object model, like other SQL drivers.
The auth module works fine on djongo