django

views created in django-page-CMS disables all CSS? code included, a fix please

I am using Django-page-CMS Everything works fine However once I create my own views which extend from pages used within the CMS the CSS does not display. This is strange because these pages display the CSS fine, as long as I do not use my own views. I would greatly appreciate some help on this matter or at least some suggestions on wh...

Adding database module

I am new to django I would like to start a project but when i run it i get this error Error loading MySQLdb module How do i add the MYSQL module or any other module for that matter ...

Localization of Django application only applies to forms.py and not to models.py

I have a problem when trying to localize my application. It is available in two languages: english and german. The problem appears when the browser has the language set english(United States) and in my settings file is set to 'de' and vice-versa. Some fields appear in english, others in german. My model contains CharField, DecimalField a...

Django South migration error "contains null values" with null=True field

When adding a field for easy-thumbnails to a model easy_thumbnail = ThumbnailerImageField( null=True, blank=True, verbose_name=_("Easy_Thumbnails"), upload_to="easy_thumbnails", resize_source=dict(size=(100, 100), crop="smart"), ) When executing ./manage.py schemamigration test --auto, South produces the following migratio...

Django : looking for a good LDAP manipulation library

Hi ! I am looking for a good ldap library on Django, that would allow me to manage my ldap server : adding, modifying, deleting entries for groups, users, and all kind of objects The library django-ldapdb looked promising, it offers a Model base class that can be used to declare ldap objects in a Django fashion (which is what we idea...

Django admin site: how to include conditional fields?

Hello, I wonder if is it possible to add some conditional fields in django. Say I have a category model which has an ID, name and description fields. What I would like is to add a many-to-many field in my Product model that links it with the Category ID model... and as a helping reference show what the name of that Category would be. I k...

Django Monthly/quartarly grouping of DateField() data

I've got a django model which contains, among other things, a DateField() attribute: class Table(): date = models.DateField() value = models.FloatField() I'm writing a view that groups this data by week, month Quarter and year. I've hardcoded a calculation that gets my monthly value simply enough - by adding up all the values ...

How do you limit list objects template side, rather than view side

One of the ways to limit objects is to add a limitation to a function like this def ---(): ---- = ---.objects.all()[0:10] #limit to 10 return {'objects': objects} However how do you achieve this inside a template rather than inside a view? I know you can filter through objects within a template and limit characters but how do you ac...

Sending data to django server from a non-django server

Hi all, I am making a bookmarklet where I need people to login first. My question is how do I send login credentials to the django server from a different domain? I was thinking there were a couple ways, since I can't use send data via request. Generate the sha1 algo on the client-side...but then how do I know what Django is salting ...

Check if Session Key is Set in Django

I am attempting to create a relatively simple shopping cart in Django. I am storing the cart in request.session['cart']. Therefore, I'll need to access the data in this session when anything is added to it. However, if the session is not already set, I cannot access it without receiving an error. Is there anyway to check if a session is ...

Reportlab - Pie chart fill colors

I am making a simple pie chart in reportlab. I can not find in the docs how to change each individual pies fill color. pie_chart = Drawing(200, 200) pc = Pie() pc.x = 65 pc.y = 15 pc.width = 150 pc.height = 150 pc.data = [65,13,12,9,1] pc.labels = ['Name','Another','Yet Another','Test','Stack'] pc.slices[1]. // This is where I need t...

MEDIA_URL tuple

I would like to write a context_processor, something like this: settings.py: MEDIA_URLS = ('cname2.example.com/media', 'cname3.example.com/media',) TEMPLATE_CONTEXT_PROCESSORS = ( "util.context_processors.media", ) util/context_processors.py from random import choice from django.conf import settings def media(request): """ ...

Django create/alter tables on demand

Hi All, I've been looking for a way to define database tables and alter them via a Django API. For example, I'd like to be write some code which directly manipulates table DDL and allow me to define tables or add columns to a table on demand programmatically (without running a syncdb). I realize that django-south and django-evoluti...

Problem with Django request.GET and multiple variables for the same parameter name

In a django view etc. you can access the request.GET['variablename'], so in your view you can return do something like this: myvar = request.GET['myvar'] The actual request.GET['myvar'] object type is: <class 'django.http.QueryDict'> Now, if you want to pass multiple variables with for the same parameter name i.e http://mysite.co...

What are the advantages of using ForeignKey in Django?

This is an extremely naive question. As you can tell, it comes from someone who doesn't know much about either databases or Django. What are the advantages of using ForeignKeys in Django? Maybe an example will help me understand better. I have tables like this already: City: id = IntegerField() # e.g. 15 name = CharField() # ...

How to make NSLog work with Python's logging module when using PyObjC?

I'm writing a Django-based webapp that imports a Cocoa framework via PyObjC. The Cocoa framework has NSLog() littered all through it and while I can see them when running the Django server in non-daemon mode, as soon as I go to daemon I simply lose all this useful NSLog() output. Is there any easy way to get NSLog stuff to bubble up in...

django heterogeneous queryset proxy models

Howdy, I am trying to figure out how to use proxy classes in Django. I want to receive a queryset where each object belongs to a proxy class of a common super class so that I can run custom sub-classed methods with the same name and my controller logic doesn't need to know or care about which kind of Proxy model it is working with. One ...

Handling Simultaneous Session Updates

In my django app, I have one AJAX view that gets flooded with calls to an update method, which I'll call IncrementMagicNumber: def IncrementMagicNumber(request) : number = request.GET['increment'] request.session['magicnumber'] = request.session['magicnumber'] + int(number) return HttpResponse("OK!") This works fine for one u...

How do I use JQuery UI tabs with Django (or other tab-solution)?

Hi, I would like to use the JQuery UI tabs in my Django app but how should I do that? I cannot figure it out with Django's template system. Or, is it another smoother way to get tabs in a Django app? Thanks /Tobbe ...

Issue happens when installing Django on Windows 7

Hi, I've got an issue when installing Django. The official guide says open cmd with administrator privileges and run "setup.py install" I did this but then the system default python editor came out, I don't know how to do anymore, please help me~ ...