I currently have the following ValuesQuerySet object after running the following code:
sites = Sites.objects.values('name')
# output
[{'name': u'serverfault.com'}, {'name': u'superuser.com'}, {'name': u'stackoverflow.com'}]
I want to move stackoverflow.com to the beginning of the list, how do I do that? I can exclude stackoverflow.c...
For the following models:
class Topping(models.Model):
name = models.CharField(max_length=100)
class Pizza(models.Model):
name = models.CharField(max_length=100)
toppings = models.ManyToManyField(Toppping)
My data looks like the following:
Pizza and Topping tables joined:
ID NAME TOPPINGS
--------------------...
My second not-so-adept question of the day: I have a django project with four installed apps. When I run manage.py syndb, it only creates tables for two of them. To my knowledge, there are no problems in any of my models files, and all the apps are specified in INSTALLED_APPS in my settings file. Manage.py syndb just seems to ignore two ...
In my application, I am sending periodic cron and background task requests to refresh the cache of pages. While sending a force_refresh kwarg from the view is easy, there's no apparent way to send the force_refresh kwarg to methods being accessed from the template. There are plenty of these I'm using, and it would just make things more c...
I've a model like this with django 1.1:
class Booking(models.Model):
name = models.CharField(max_length=100)
By default, I'm reading that both 'null' and 'blank' are False.
So with a test like this...
class SimpleTest(TestCase):
def test_booking_save(self):
b = Booking()
b.save()
... I expected the save to ...
I'm planing to deploy a django powered site. But I feel confused about the choice of web servers, which includes apache, lighttpd, nginx and others.
I've read some articles about the performance of each of these choice. But it seems no one agrees. So I'm wondering why not test the performance by myself?
I can't find information about ...
Hi,
I was hoping to get some suggestions on some best approaches to develop a multi tenant Django project on Google AppEngine.
Some Thoughts to Consider.
I would assume using djnago.contrib.sites is a must.
I would like to use existing applications such as django-profiles and django-registration, I know their models would need porti...
Hi;
I would like to change the class attribute of an li after each 4 elements (that means 5th, 9th, 13th li element classes should be changed).
I have tried something like below but it gave me an syntax error:
Could not parse the remainder: '%4' from 'forloop.counter%4'
{% for p in plist %}
{% ifequal forloop.counter%4 1 %}
<li class...
Is there an application for django which tracks CRUD for objects inside a project?
...
In Django, I'm trying to write a URLconf and view that can take a theoretically unlimited number of "tags". The reason for this is to retrieve objects that have been tagged with different combinations of tags.
For example, URLs like this are desireable:
/topics/tag1/tag2/tag3
The above URL would retrieve "topics" that have been tagge...
I want to have an input element at the to of my webpage that contains some global settings for a logged in user. How could I attach this piece of data to every single GET/POST and AJAX request that comes in from my web application? I wanted to tack this onto an existing site that has a lot of code already.
Cookies aren't what I'm look...
Joel seems to think highly of daily builds. For a traditional compiled application I can certainly see his justification, but how does this parallel over to web development -- or does it not?
A bit about the project I'm asking for --
There are 2 developers working on a Django (Python) web app. We have 1 svn repository. Each developer...
If you multiple subdomains e.g.:
sub1.domain_name.com
sub2.domain_name.com
Is there a way to have a user be able to log into both of these without issues and double login issue?
The platform is Python, Django.
...
I want to let the same user session span across:
site.com
sub1.site.com
sub2.site.com
How can I do this in Django? With the default auth user package it seems to require the user to login to all 3 sites each time with a different session. How can they share the same login cookie and session-id?
UPDATE: Using the SESSION_COOKIE_DOMAIN...
Hello,
I am trying to learn Django (and Python) and have created my own app based on the Tutorial found in Djangoproject.com.
My model is like this:
from django.db import models
class Blog(models.Model):
author = models.CharField(max_length=200)
title = models.CharField(max_length=200)
content = models.CharField(max_leng...
Hi guys, im using Django Profiles, and i need to make some change in the profile form.
In the normal way my form is fine completly, but now i would like a litter change, add jquery for repopulate a select form.
The problem is that Django Profile make the form from the model, so i would like to add a attribute id to the select form (i d...
I have a dumb simple loop
for alias in models.Alias.objects.all() :
alias.update_points()
but looking into the django QuerySet it seems to keep around a _result_cache of all the previous results. This is eating Gigs and Gigs of my machine and eventually everything blows up.
How can I throw away all the stuff that I won't ever ca...
Let's say I have model app1.models.ModelOne defined with save decorated with @commit_on_success. All the exceptions caught in ModelOne.save() are re-raised. Works fine on model_one_instance.save().
However, in app2 I need to make series of insertions to ModelOne and rollback all of them if any of them fails. How do I accomplish this?
...
I'm new to Django so I just made up an project to get to know it but I'm having a little problem with this code, I want to be able to as the car obj if it is available so I do a:
>>>cars = Car.objects.all()
>>>print cars[0].category
>>>'A'
>>>cars[0].available(fr, to)
that results in a:
>>>global name 'category' is not defined
So i...
There was a question about hosting for django on SO, but I am looking for free one, to experiment with my first "startup" :)
There is only one free on http://code.djangoproject.com/wiki/DjangoFriendlyWebHosts , but it couldn't be profitable (http://www.ambitiouslemon.com/). My app eventually will be, I hope! :)
Do you know any easy to ...