django

Django: Passing argument to parent template

Hello everyone I have templates of this style project - main_templates (including nav bar) -- app1 --- app1_base_template --- app1_templates -- app2 --- app2_base_template --- app2_templates So when rendering, app2_templates extends app2_base_template which extends main_template. What I need to do, is have the corresponding nav ite...

csv2json.py error

I am trying to run the script csv2json.py in the Command Prompt, but I get this error: C:\Users\A\Documents\PROJECTS\Django\sw2>csv2json.py csvtest1.csv wkw1.Lawyer Converting C:\Users\A\Documents\PROJECTS\Django\sw2csvtest1.csv from CSV to JSON as C:\Users\A\Documents\PROJECTS\Django\sw2csvtest1.csv.json Traceback (most recent call la...

Tips on using Git with svn in presence of a large number of svn externals

I have a workflow(on svn) which I am trying to replicate with git, but am unable to. I have a large number of Django apps (which are plugged together to form a form a full project) Some of these are in one large repo and others are in smaller repos. My layout looks something like, app1 -> repo1/app1 app2 -> repo2/app2 app3 -> repo1/ap...

Django loaddata ValidationError

This thread got too confusing (for me) so I am asking the question again. I could not make the csv2json.py script mentioned in the original question work. I am just trying to find a way to import data to sqlite3 database. Here's the model I am working with: from django.db import models class School(models.Model): school = mode...

Django: allow line break from textarea input.

How do i allow line breaking in textarea input in django to later show this input on page? ...

Sorting products after dateinterval and weight

What I want is to be able to get this weeks/this months/this years etc. hotest products. So I have a model named ProductStatistics that will log each hit and each purchase on a day-to-day basis. This is the models I have got to work with: class Product(models.Model): name = models.CharField(_("Name"), max_length=200) slug = models...

Django-Tagging - count and ordering top "tags" (Is there a cleaner solution to mine?)

I'm using Django-Tagging, and I don't exactly need a cloud, I just want a limited list of the most popular tags used in my blog entries. Using the following: [(tag.name, int(tag.count)) for tag in Tag.objects.usage_for_model(Post, counts=True)] It returns an array (note I'm using Lorem Ipsum while I develop): [(u'deposit', 5), (u'e...

Why does Django say I haven't set DATABASE_ENGINE yet?

I have a Django project, and I'm somewhat of a newbie in it. I have the following PyUnit test trying to save an object into a PostgreSQL database: import unittest from foo.models import ObjectType class DbTest(unittest.TestCase): def testDBConnection(self): object_type = ObjectType() object_type.name = 'Test Obje...

Choicefield render does not distinct between empty string or Decimal('0')

Hi all, I've got a form that renders a choicefield widget with a total of 3 choice values: 0, 6, 19 (these are of type "Decimal'). When editing an object via a modelform that has the value 6 or 19 the widget has selected the proper one when rendered, but when the object is stored with the value "Decimal('0') it has selected the empty_...

Open source feedback Web application

There are feedback services some companies are using now such as getsatisfaction.com and uservoice.com. Is there any open source equivalent (preferably Django based) to these services? ...

Different initial data for each form in a Django formset

Is it possible to prepopulate a formset with different data for each row? I'd like to put some information in hidden fields from a previous view. According to the docs you can only set initial across the board. ...

Associate and display additional data with each form row in a Django formset

I'd like to be able to display additional information like a text label with each row in a Django formset. Example/usecase: User picks 5 rows in a model that would he would like some action performed. A popup appears that displays a 5 form formset some additional information (that are model instance methods) based on the 5 rows chosen...

Django Template Slice - Reversing Order

Thanks to a very helpful hint from another question I learned I can limit the amount of values in a list by slicing it in the template as such: {% for comment in thread.comment_set.all|slice:":3" %} Now I would like to get the last 3 results of my comments so I figured a simple ":-3" or "-3" would do the trick, alas: Caught an except...

Using Django middleware to check GET variables in current page URL

Can I use a middleware to preserve several user selected choices in between page requests? I have several values, namely vehicle year, make, model, series, style, color, and transmission. I want to have the user being able to select a choice while keeping the previously selected choice active. I do not want to use sessions for this a...

[Django] How to replace an image using ModelForm?

I have a user profile model which holds their 'mugshot' image. I'm using modelForm to to present a profile update form. It was easy to build a working form, but now I need a couple of tweaks to the image: 1) it saves with the filename that the user provides; I rather dictate the filename to use. I thought I'd just use the PK of the mo...

Serializing resultset returned from mysqldb in python

Can anyone please help me in serializing resultset returned using mysqldb in python? I get typeerror: datetime.date(2007, 11, 15) is not JSON serializable What is the best way to do serialize into Json object in python? I am using json.dumps(resultset) to serialize resultset... ...

How to get field name......

Recently i have implemented django-sphinx search on my website. It is working fine of each separate model. But now my client requirement has changed. To implement that functionality i need field name to whom search is made. suppose my query is: "select id, name,description from table1" and search keyword is matched with value in field...

django urlencode filter

I have a problem with encoding urls using build-in django urlencode filter. When I use it on default django server everything is fine. But on apache2 it doesn`t work, ie. i have a tag called C#. On localhost my url is encoded to ...tags/C%23/ but on apache2 it is tags/C/ What should I do? ...

jQuery and Django - append()

Hi there I am trying to append my JSON data to a div. For some reason I am not seeing, it does not append. The data is collected correctly from Django view, I can see this is the FireBug console. Here is my JS $.getJSON('/chat/xhr_test/', function(response_array) { var arr = response_array; $.each(arr, function(count, item) {...

Clean/Disable forms history

Hi! I am building my chat app using Djago and Ajax. How d I disable the form history popping up while typing in a message? Its annoying! :-0) ...