duplicate: Django Admin - Re-authentication?
I'm looking for a way to separate the session handling for the admin part of a site (django.contrib.admin) and the frontend - the rest.
A person should be able to log in to the admin (only if he has is_staff and/or is_superuser), but if he gets to the frontend he should remain not logged...
I would like to know if it's possible to use django over existing db tables that defines the models.
Instead of defining models in order to create db tables
...
Hello,
I have a server on which I have two sites built with Django and Python, one site is major site is build with an older version of django, the other with the newer release, I have upgraded to the new release and major aspects of my other site have broken, is it possible to tell the site to use a different version in say the pytho...
Is it possible to implement column level permissions per user in the Django admin site?
Its a small project and I only need two groups of permissions.
In the docs I cant find anything out of the box however I was wondering if its possible to create two admin sites and use separate ModelAdmin.exclude or ModelAdmin.fields for each one? I...
There are a lot of complex forms in my project and I keep getting the feeling that I could be coding them much more elegantly and simply.
So my question is what are some good apps and practices that might help me? Specifically, I'm thinking about situations when I need to do stuff like:
edit/add more than one object via one form (examp...
How can I change the default behavior in the markdown filter so that it transforms a newline to a br tag?
...
Hello,
I have been working on a shop that is built in Python on the back of the django framework, everything was working fine until I noticed that when a user proceeds to the checkout and is requested to log in they do so and their basket empties...obvioulsy this is not a great thing for a basket to do, I was wondering what is causing...
I've created a simple contact form using the modelformset_factory to build the form in the view using the DB model. The issue that I am having is that the is_valid() check before the save() is not working. When I submit the form with empty fields it still passes the is_valid() and attempts to write to the DB.
I would like the is_vali...
There have been similar questions on StackOverflow about this, but I haven't found quite the same situation. This is on a OS X Leopard machine using MySQL
Some starting information:
MySQL Server version 5.1.30
Apache/2.2.13 (Unix)
Python 2.5.1
mod_wsgi 3
mysqladmin also has skip-networking listed as OFF
I am able to connect to m...
I am using: datetime.now() to get the current time in an Event app that lets you create an event that has an end date, then all of the events are displayed in a calendar and if an event is passed due it is displayed in red.
My issue is that I have some users in different timezones than me saying that the events are ending at the wrong...
I am trying to build a RESTful api with Django to share mp3s -- right up front: it's a toy app, never going into production, so it doesn't need to scale or worry (I hope) about copyright devils.
My problem now is that I have a Django view that I want to be the endpoint for HTTP PUT requests. The headers of the PUT will contain the metad...
This is my simple Django database model. It's for a 5-star rating system.
class Rating(models.Model):
content = models.OneToOneField(Content, primary_key=True)
ip = models.CharField(max_length=200, blank=True)
rating = models.IntegerField(default=0)
As you can see, it is linked to "Content", which is the table for my docu...
I have some big data sets that I am looping through to display a table of data. The trouble is the looping takes a ton of time, which is okay at the moment as this is an internal tool but I would like to improve it.
The model:
class Metric_Data(models.Model):
metric = models.ForeignKey(Metric)
count = models.IntegerField()
start_...
I've used Django's inspectdb command in the past, which gives you models from an existing database.
Is there something equivalent for SQLAlchemy?
...
I did see the other question titled 'how to use django reverse a generic view' and 'django named urls, generic views' however my question is a little different and I do not believe it is a dupe.
Code:
from django.views.generic import list_detail, create_update
from django.core.urlresolvers import reverse
from django.conf.urls.defaults ...
i've write a middware like this:
class LogMiddleware( object ):
def process_request( self, request ):
logging.debug("start")
def process_response( self, request, response ):
logging.debug("end")
return response
and i put it in the bottom of MIDDLEWARE_CLASSES
most time it works fine.
and when i test with url /admin wi...
In my project I have a lot of Ajax methods, with external client-side scripts (I don't want to include JavaScript into templates!) and changing URLs is kind of pain for me because I need to change URLs in my Ajax calls manually.
Is there is some way to emulate the behavior of {% url %} templatetag in JavaScript?
For example, print ur...
Django application requires a later version of Python. I just installed it to 2.5 (from 2.4) and now when I do a python at the command line, it says 2.5.2.
Having said that, Django still says Python Version: 2.4.3.
How do I correct this? I've rebooted / restarted / redeployed to no avail.
...
I would like to be able to connect to Oracle 10.1.0.2.0 (which is installed on different machine) via python.
My comp is running on Ubuntu 9.04 Jaunty with Python 2.6 installed.
I have downloaded and unpacked instantclient-basic-linux32-10.1.0.5-20060511.zip , set LD_LIBRARY_PATH and ORACLE_HOME to point to the directory where I unpack...
Hope all this makes sense :) I'll clarify via comments if necessary. Also, I am experimenting using bold text in this question, and will edit it out if I (or you) find it distracting. With that out of the way...
Using django.contrib.auth gives us User and Group, among other useful things that I can't do without (like basic messaging).
...