django

How to run django unit-tests on production database?

Hi, i'm starting the TDD development attitude and am writting unit-tests for my django application. I'm aware of fixtures and know that's the way tests should be executed, but for a given test i do need to execute it on the whole database, and json fixture for 10+ million row database is not something i'd like to handle, moreover, this ...

referencing a key/value in django-templates after applying a filter

say I have the following list that I provide to a django template stuff= [ { 'a':2 , 'b':4 } , { 'a',7} ] I want to access the 'a' attribute of the first element. I can't quite get the syntax right. {{stuff|first}} gives me the first element, but {{stuff|first.a}} is a dead end ( and weird ) and I can't seem to find a attribute...

Correct way to access related objects

Hi, I have the following models class Person(models.Model): name = models.CharField(max_length=100) class Employee(Person): job = model.Charfield(max_length=200) class PhoneNumber(models.Model): person = models.ForeignKey(Person) How do I access the PhoneNumbers associated with an employee if I have the employee id? Cu...

How can I send an iCalendar email attachment with Django?

I want to send an iCalendar http://en.wikipedia.org/wiki/ICalendar email attachment using Django. Is there an open source library to build an iCalendar file in Python and/or available for Django? ...

mod_python django logging problem

I use logging settings as below in the settings.py file: logging.basicConfig(level=LOG_LEVEL, format=LOG_FORMAT); handler = logging.handlers.RotatingFileHandler( LOG_FILE_PATH, 'a', LOG_FILE_SIZE,LOG_FILE_NUM ); formatter = logging.Formatter ( LOG_FORMAT ); handler.setFormatter(formatter); logging.getLogger().addHandler(handler) ...

jqgrid and django models

Hi, I have the following models class Employee(Person): job = model.Charfield(max_length=200) class Address(models.Model): street = models.CharField(max_length=200) city = models.CharField(max_length=200) class EmpAddress(Address): date_occupied = models.DateField() date_vacated = models.DateField() employee = models.Fo...

Is there a rails.vim equivalent for Django?

I love Tim Pope's rails.vim, and I'm wondering if there's an equivalent vim plugin for Django. I'm especially looking for easy navigation of the Django file structure via vim command mode. ...

Is there a way to create an exception in django 1.0 csrf protection?

I know there is in the development version of Django, but I don't see this in Django 1.0. I took a look of the code and such an exception is definitely not built in. I need to have this ability as I can't add the csrf middleware token to a third party flash app I am using which needs to make a POST request back to django. :( Anyone have...

Common errors when moving a django app from dev to prod?

Hello, I am developping a django app on Windows, SQLite and the django dev server . I have deployed it to my host server which is running Linux, Apache, FastCgi, MySQL. Unfortunately, I have an error returned by the server on the prod while everything ok on the dev machine. I've asked my provider for a pre-production solution in order ...

How to use lxml to get a message from a website?

At exam.com is not about the weather: Tokyo: 25°C I want to use Django 1.1 and lxml to get information at the website. I want to get information that is of "25" only. HTML exam.com structure as follows: <p id="resultWeather"> <b>Weather</b> Tokyo: <b>25</b>°C </p> I'm a student. I'm doing a small project with my friend...

Overriding Django views with decorators

I have a situation that requires redirecting users who are already logged in away from the login page to another page. I have seen mention that this can be accomplished with decorators which makes sense, but I am fairly new to using them. However, I am using the django login and a third party view (from django-registration). I do not ...

Best Practices: How to best implement Rating-Stars in Django Templates

I would like to have reusable ratings (typical layout with 5 stars). I have found this http://www.thebroth.com/blog/119/css-rating-stars that explains how to display this using css. For actually collecting the rating I was thinking of using an image map or maybe simple radio buttons. I would like to use this on various different models...

Django/IE8 Admin Interface Weirdness

Esteemed Django experts and users: I have been using Django's admin interface for some data editing needs. I am using it on Windows Server 2008, and using django-mssql to connect to a SQL Server backend. Python 2.6.2 Django 1.1.0 final 0 As per usual w/ Django, this was fairly easy to set up, and works beautifully on Firefox, but using...

How Do I Create a Python / Django Egg?

I have a Python program (with Django - does this matter?) that I want to 'bundle', if you like. How do I do this, in the same way one can create a .jar for Java? ...

How can I scrape the number of fans for my facebook app?

I just want a simple a way to grab the number of fans. I can do this on the serverside with python preferably. I'm open to doing it with a piece of the javascript api. This is for an edge case. I want to essentially have a fanbox as http://wiki.developers.facebook.com/index.php/Fan_Box: <div id="facebook-fanbox" class="span-5 last">...

Django CSRF framework cannot be disabled and is breaking my site

The django csrf middleware can't be disabled. I've commented it out from my Middleware of my project but my logins are failing due to missing CSRF issues. I'm working from the Django trunk. How can CSRF cause issues if it is not enabled in middleware? I have to disable it because there are lots of POST requests on my site that CSRF j...

How do i parse JSON strings using Django template library.

How do i parse JSON strings using Django template library. I can parse it using javascript in my template, but I would like to parse the json in the template library when it is rendered by the server. Is there a way to do it. - Amey Kanade ...

Django Trunk Stability

How stable is the Django trunk? I am getting this issue today from updating my Django trunk: 403 Forbidden CSRF verification failed. Request aborted. More information is available with DEBUG=True. ...

How can I store many Django model types in a database and access them as an object?

I have the following Django models: Bar, Bistro and Restaurant Each of the above establishment has their own menu items, for instance: Bar Burger Fries ... Bistro Pasta Pizza ... Restaurant Duck Wings ... I have different type of images in my home page, a main banner, left side bar and right side bar. Each of those images w...

Is there a way to filter a queryset in the django admin?

I'm trying to define an action for a model Bar -- but I only want the list of Bar objects related to a user Foo. Before I start mucking around in the admin code and passing in a custom queryset (or writing a custom view that hijacks the admin's multi-checkbox support), I figured I'd check to see if there were a way I could slice up the ...