django

Django Interleaving UserProfile with Profile in Admin

I have a User Profile which is currently shown in the Admin via a Stacked Inline. However because I have fields such as last_name_prefix and last_name_suffix (for foreign names such as Piet van Dijk to cover proper sorting by last name) I would like to be able interleave the user profile fields with the normal change user fields. So in t...

Is there a framework or pattern for applying filters to data?

The problem: I have some hierarchical data in a Django application that will be passed on through to javascript. Some of this data will need to be filtered out from javascript based on the state of several data classes in the javascript. I need a way of defining the filters in the backend (Django) that will then be applied in javascript...

Why do I get 500 error codes on certain URLs on certain servers with certain client certificates?

Warning: I've found a weird reason for this behaviour. The question below is obsolete. Here is the followup for all the gory details. Setup: A production server running SuSE Enterprise 11 and my Django 1.1 application. The application is being served with Apache (mod_wsgi) over HTTPS with client certificates (SSLVerifyClient require...

Is django-piston mature enough?

Hello. I'm developing an advertising site. Want to use Web-Services for the requests. I mean, a publisher site will put a JS snippet and it will pull a banner through a REST GET. Is this framework mature enough to implement this functionality? Thanks ...

Weighted search in Django

I have three inputs coming in from a form. They are name, neighborhoods and tags. Neighborhoods and tags are multi-select box string lists. Here is my current query: q = Restaurant.objects.filter(name__icontains=name) q = q.filter(neighborhoods__name__in=neighborhoods) for tag in tags: q = q.filter(tags__name=tag) q = q.order_by('na...

google analytics creates broken links for IE8

We have been successfully running a Django site for a couple of years. We use the following (standard) google analytics code for most of our pages. <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-XXXXXXX-X']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga...

django manual database migration

Hi all, I am preferring to manually migrate my tables in Django. Because using automated tools puts me in a place where I cannot see the impact. With impact, I mean the the time it takes the db get in synch with my models. Below is a simple example: class User(models.Model): first_name = CharField(..) Let's say I want to add this:...

Why does Django/mod_wsgi crash on certain URL lengths?

I've got a weird problem here: I'm getting a 500 error code from Apache serving a Django 1.1 application when the length of the path part of the URL given to Apache is in [23..26,30..33]. For example, http://server/012345678901234567890123 results in a 500 error while http://server/012345678901234567 does not. Each 500 error also result...

Serializing Foreign Key objects in Django

I have been working on developing some RESTful Services in Django to be used with both Flash and Android apps. Developing the services interface has been quite simple, but I have been running into an issue with serializing objects that have foreign key and many to many relationships. I have a model like this: class Artifact( models.Mod...

Django: routing same model but different category field to separate URLs

I have the following model and url routes. There is one Post model that I want to route to different URLs based on the category. Is there a way to do this by passing in extra information in app/urls.py? In app/posts/models.py class Post(models.Model): author = ... title = ... body = ... category = models.CharField() ...

How to capture multiple arguments using a single RegEx in my Django urls.py?

I've got an application that allows you to filter data via 3 fields. I'm trying to write a RegEx in my urls.py that can capture multiple combinations without having to write-out each possible combination it it's own URL. Here's my urls.py: #urls.py urlpatterns = patterns('', # Uncomment the next line to enable the admin: (r...

Saving a StackedInline foreign keyed model before primary model in Django Admin

I have four models with the relationships Model PagetTemplate(models.Model): pass Model TextKey(models.Model): page_template = models.ForeignKey(PageTemplate, related_name='text_keys') Model Page(models.Model): page_template = models.ForeignKey(Pagetemplate, related_name='pages') Model Text(models.Model): key = model...

Django newbie question regarding defining an object with subobjects from models for use in templates

I am somewhat new to Django and have searched for some simple examples of creating objects with subobjects in views so that in templates I can have nested for loops. Here is my models.py for this application... from django.db import models from django import forms class Market(models.Model): name = models.CharField('Market name'...

Displaying reverse many-to-many in Django Templates

I'm in the midst of creating an alarm/notification system for a small Sales CRM app. I have a Lead_Contact model that is used to store a client's name, address, etc. as well as a Contact_Notifier models that is being used to keep track of when a client was first contacted, the last contact, and when we are going to next contact them. F...

Form.save(commit=False) behaving differently in Django 1.2.3?

Prior to today, I've been using Django 1.1. To ensure I'm keeping up with the times, I decided to update my Django environment to use Django 1.2.3. Unfortunately, I've encountered an issue. The following code did not raise a ValueError in 1.1: instance = FormClass( request.POST, instance=existing_instan...

Django modules for working with DoubleClick?

Since Django has its roots in news websites, I'm surprised that I haven't been able to find any good modules for working with DoubleClick / DART ads. I'm going to being doing some DoubleClick integration, and I'd hate to have to reinvent the wheel so if an existing project exists, I'd appreciate a point in the right direction. edit: I ...

Django order by field comparison.

I need to order_by a field comparison such that all fields matching a certain value are displayed at the top. The SQL to do this is SELECT * FROM messages ORDER BY message='alsfkjsag' DESC ...

jquery time ago with unix epoch

Hi, I'm using django currently and outputting the date in seconds from the unix epoch. How do I use jquery time ago with unix epoch? I see this example: January 10, 2015 <abbr class="timeago" title="2015-01-10T15:00:00Z">January 10, 2015</abbr> but can i do something like: <abbr class="timeago" title="2015-01-10T15:00:00Z">{{UNI...

Unable to load profile in django

Hey! I am trying to add additional fields to the default User model. I had a look around the internet and done something like this: Made a new model named UserProfile with the following in /UserProfile/models.py: from django.db import models from django.contrib.auth.models import User class UserProfile(models.Model): # This is the...

Django {{ MEDIA_URL }} blank

I have banged my head over this for the last few hours. I can not get {{ MEDIA_URL }} to show up in settings.py .. MEDIA_URL = 'http://10.10.0.106/ame/' .. TEMPLATE_CONTEXT_PROCESSORS = ( "django.contrib.auth.context_processors.auth", "django.core.context_processors.media", ) .. in my view i have from django.shortcuts import ren...