django

Making Django development server faster at serving static media

I'm using the Django manage.py runserver for developing my application (obviously), but it takes 10 seconds to completely load a page because the development server is very, very slow at serving static media. Is there any way to speed it up or some kind of workaround? I'm using Windows 7. ...

Storing Content with Complex Structure using Django

Is there a recommended best-practice for storing content that has a complex structure. For example, suppose a typical "article" I am trying to serve may have the following hierarchy: Header #1 Subheader #1.a) Text content Image content Text Content Subheader #1.b) Text Content Other complex content ty...

Django paths, developing in windows, deploying on linux

I'm developing Django apps on my local windows machine then deploying to a hosted linux server. The format for paths is different between the two and manually replacing before deployment is consuming more time than it should. I could code based on a variable in my settings file and if statements but I was wondering if anyone had best pra...

OpenID or Auth in Django?

What are the pros and cons of using open id vs auth? Shoud I do both? ...

Django default admin panel security

Hello I am curious about the security of default admin panel of Django. For a live Django website, I will be using Django admin for all management and it feels like simply asking username and password at the mysite.com/admin/ url is kinda weak against brute force attemps (or maybe dictionary based attempts. I have very little knowledge ...

Can Django do nested queries and exclusions

I need some help putting together this query in Django. I've simplified the example here to just cut right to the point. MyModel(models.Model): created = models.DateTimeField() user = models.ForeignKey(User) data = models.BooleanField() The query I'd like to create in English would sound like: Give me every record that w...

Django URLs - How to pass a list of items via clean URLs?

Hi all, I need to implement a structure similar to this: example.com/folder1/folder2/folder3/../view (there can be other things at the end instead of "view") The depth of this structure is not known, and there can be a folder buried deep inside the tree. It is essential to get this exact URL pattern, i.e. I cannot just go for example.c...

AttributeError: 'str' object has no attribute '_meta' (when using South)

I'm getting this error when I use 'startmigration' in South. My guess is that I have data that is not serializable. What is the best way for me to determine the offending model? ...

datetime rendering in the admin forms

I have the following Model and ModelAdmin classes. However when I view the posts in the admin list page, the created fields are rendered as 2010-03-01 22:15:18.494594. I've tried setting the DATETIME_FORMAT variable in settings.py, but that didn't help. Any ideas how to control the formatting of datetime fields in the admin forms. PS...

Django and Lytebox - posting form data

I'm trying to display poll results using lytebox but can't work out how to pass either GET/POST variables to the page I'm calling. Lytebox is working fine as this loads the page ok: <a href="/polls/1/results" rel="lyteframe" title="Example Poll" rev="width: 400px; height: 450px; scrolling: yes;">Results</a> But I want to get the val...

Is there any way to do a case-insensitive IN query in Django?

Nearly every kind of lookup in Django has a case-insensitive version, EXCEPT in, it appears. This is a problem because sometimes I need to do a lookup where I am certain the case will be incorrect. Products.objects.filter(code__in=[user_entered_data_as_list]) Is there anything I can do to deal with this? Have people come up with a ha...

Delete() views and template code

Template: <form method="POST" action="/customer/delete/"> <div style="float: right; margin: 0px; padding: 05px; "> Name:<select name="customer"> {% for customer in customer %} <option value="{{ customer.name|escape }}" ></option><br /> {% endfor %} </select> <input type=submit value="delete"> </div> </form> Views: d...

django template not displayin names in drop down box

<form method="POST" action="/customer/{{ action }}/"> <div style="float: right; margin: 0px; padding: 05px; "> Name:<select for="customer" > <option value="{{ customer.name|escape }}" name="customer"></option><br /> </select> <input type=submit value="delete"> </div> </form> Customer is a model,name is attribute it sho...

django error :1146, "Table 'basic_project.topics_topic' doesn't exist"

TemplateSyntaxError at /tribes/ Caught an exception while rendering: (1146, "Table 'basic_project.topics_topic' doesn't exist") why ?? thanks ...

Django app on it's own subdomain

Did a few searches but couldn't find anything good about this problem. I've got the following setup. / (index), /blog/ and /about/. The way I do want it to be displayed, running only one Django instance is blog.domain.com (for my blog app) and all the other urls to run under (www.)domain.com/. I could surely hardcode the links, forcing...

Python: Access Posix' locale database without setlocale()

The setup is a Django based website on an Ubuntu server system with lots of useful information in /usr/share/i18n/locales. The question: Can I access this pool of wisdom without using Python's locale.setlocale() afore? The reason: The docs say, that it is very expensive to call setlocale(), and affects the whole application. But in...

Profiling Django

My django application has become painfully slow on the production. Prolly it is due to some complex or unindexed queries. Is there any django-ish way to profile my application? ...

problem with select and related model

I have models like this: class IdfPracownicy(models.Model): nazwa = models.CharField(max_length=100) class IdfPracaOpinie(models.Model): nazwa = models.CharField(max_length=30) class IdfPraca(models.Model): numer_idf = models.ForeignKey(IdfPracownicy) [...] opinia = models.ForeignKey(IdfPracaOpinie) uwagi = model...

print value of a column in django

How to print the test field in the following query in django res=Resources.objects.filter(test=request.profile) logging.debug(test) # won't work I wanted to check what this value is compared with.. ...

django modeltranslation registers "0" models

I have a Django project that employs modeltranslation. On the development box, it registers 10 models and works flawlessly. On the production server, when started it notifies that it has registered "0" models (instead of 10) and doesn't throw any exceptions. However when any admin page that shows a should-be-registered model is visited...