django

HttpResponseRedirect question

Cant we send a dictionary variable when using HttpResponseRedirect render_to_response('edited/display.html',context_instance=RequestContext(request,{'newlist': newlist})) //How can the dictionary and the request sent back again //sumthing like this return HttpResponseRedirect('edited/display.html',context_instance...

One admin for multiple sites

I have two sites with different SITE_IDs, but I want to have only one admin interface for both sites. I have a model, which is just an extended FlatPage: # models.py class SFlatPage(FlatPage): currobjects = CurrentSiteManager('sites') galleries = models.ManyToManyField(Gallery) # etc # admin.py class SFlatPageAdmin(FlatPa...

Django equivalent for latest entry for each user

Hi, I'm surprised this question hasn't come up. Couldn't find much on the web. Using Entry.objects.latest('created_at') I can recover the latest entry for all Entry objects, but say if I want the latest entry for each user? This is something similar to an SQL latest record query. But how do I achieve this using the ORM? Here is my appr...

what is the 'name__iexact' mean in my code ..

Map.objects.filter(name__iexact=self.cleaned_data["name"]).count() thanks ...

how to get the 'user' object in django..

i want to get the user who login now .. how to do this .. thanks this is my code : ps=Position.objects.filter(name=User.username) updated: ps=Position.objects.filter(name=request.user.username) and return render_to_response(template_name, { "map_form": map_form, "map": map, "group": map, # @@@ this shou...

django (under mod_wsgi) and php

Hello Under my debian copy, I run a django site runs via apache2 and mod_wsgi. Now I want to include a wordpress to it, for that I need to install php - apache bindings. I am curious what library is recommended for this, aswell as how shall I be doing the apache2 config file ? Here is my current apache 2 000-default file: <VirtualHost ...

integrating django-paypal

Hi I am trying to integrate Django-Paypal onto a site, where once the customer makes a payment I need to send a dynamic URL from which the user can download some specific information. I am registering all users to a URL which allows them to buy the document. The URL which can only be accessed by a registered user with a verified email...

PHP Frameworks (CodeIgniter, Yii, CakePHP) vs. Django

I have to develop a site which has to accomodate around 2000 users a day and speed is a criterion for it. Moreover, the site is a user oriented one where the user will be able to log in and check his profile, register for specific events he/she wants to participate in. The site is to be hosted on a VPS server.Although I have pretty good ...

iphone Json POST request to Django server creates QueryDict within QueryDict

I'm creating a JSON POST request from Objective C using the JSON library like so: NSMutableURLRequest *request; request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@/%@/", host, action]]]; [request setHTTPMethod:@"POST"]; [request setValue:@"application/json-rpc" forHTTPHeaderField:@"Content...

django media url is not resolved in 500 internal server error template

Hi, I'm using a 500.html template for my app, which is an identical copy of the 404.html with some minor text changes. Interestingly the {{ media_url }} context variable will not be resolved by the server if the 500.html is presented (e.g. when I force an internal server error), resulting in a page without any css loaded. An easy way ...

Alternative Django Authenication

Need to integrate Django with an existing authentication system. That system has it's own database, API, login/logout,edit profile web pages and cookie. (I may have to add a few additional profile fields stored/updated locally) What's the proper approach to substitute the out-of-the-box authentication in Django? ...

IPN delivery failed. HTTP error code 403: Forbidden

I am trying to test IPN. Working with django-paypal. What could be wrong. The URL is working. No errors otherwise... But when I test this, it says IPN delivery failed and error code is 403, ...

Building a financial app with Django

Hi guys, I'm building an app for a small business so I've to work with currencies, decimal numbers, etc... My goal is to create something like pulseapp.com. I've searched for opensource projects to look and the only thing I had found was django-cashflow. This app uses python-money. I've read some of the code and the ways it's coded see...

Unittest in Django. What is relationship between TestCase class and method

Hi: I am doing some unit testing stuff in Django. What is the relationship between TestCase class and the actual method in this class? What is the best practice for organizing these stuff? For example, I have class Test(TestCase): def __init__(self): ... def testTestA(self): #test code def testTestB(self)...

Unittest in Django. Static variable feeded into the test case

I want to generate some dynamic data and feed these data in to test cases. But I found that Django will initial the test class every time to do the test. So the data will get generated every time django test framework calls the function. Is there anyway to use something like the singleton or static variable to solve the problem? What s...

How to skip interstitial in a django view if a user hits the back button?

I have an application with an interstitial page to hold the user while an intensive operation runs in the background (takes anywhere from 30 secs to 1 minute). Once the operation is done, the user is redirected to the results page. Once on the result page, typical user behavior is to hit the 'back' button to perform the operation on a d...

Disable autocomplete on textfield in Django?

Does anyone know how you can turn off autocompletion on a textfield in Django? For example, a form that I generate from my model has an input field for a credit card number. It is bad practice to leave autocompletion on. When making the form by hand, I'd add a autocomplete="off" statement, but how do you do it in Django and still retai...

Django TestCase testing order

If there are several methods in the test class, I found that the order to execute is alphabetical. But I want to customize the order of execution. How to define the execution order? For example: testTestA will be loaded first than testTestB. class Test(TestCase): def setUp(self): ... def testTestB(self): #test ...

Filter Queryset in Django inlineformset_factory

I am trying to use inlineformset_factory to generate a formset. My models are defined as: class Measurement(models.Model): subject = models.ForeignKey(Subject) experiment = models.ForeignKey(Experiment) assay = models.ForeignKey(Assay) values = models.CommaSeparatedIntegerField(blank=True, null=True) class Experiment(m...

how does django save decimal values?

Hello what am i doing wrong? class MyModel(models.Model): name = models.CharField(max_length=100, verbose_name=_("Name"), blank=False, null=False) rating = models.DecimalField(max_digits=2, decimal_places=2, default=0) id i do something like that: average = count/len(votes) mymodel.rating = average mymodel.save() count is the...