django

Facing problem with user profile url scheme like example.com/username in django

In a django app, I need to create twitter user profile urls with following structure like: example.com/<username> example.com/<username>/friends example.com/<username>/blog example.com/<username>/some-page example.com/<username>/some-other-page My urls.py: urlpatterns = patterns('profiles.views', url(r'^(?P<account_name>[a-zA-Z0...

Template engine similar to the Django

I search template engine for PHP that's almost similar to the Django template. ...

django session timesout within 10 seconds

I've finally deployed the app. on production and the session timesout very quickly. If I'm not continuously clicking on links, it'll expire in 15-20 seconds. This doesn't happen in Dev. but again the setup is completely different. Here is the setup I have in production - nginx + apache (wsgi) + django 1.1.2 Backend is mysql. The keepa...

django: customizing display of ModelMultipleChoiceField

ModelMultipleChoiceField is displayed in a template is a list of checkboxes with unicode of representation of corresponding objects. How do I display ModelMultipleChoiceField in table form with arbitrary fields in arbitrary columns? For example: [x] | obj.name | obj.field1 ...

django custom form validation

In Django/Python, when you make a custom form, does it need to have a clean() method, or will calling .is_valid() perform a default validation? if request.method == 'POST': filter = FilterForm(request.POST) if filter.is_valid(): print 'Month is ' + filter.cleaned_data['month'] print 'Type is ' +...

scalable layout for storing and displaying user uploaded images

I am trying to figure out the best way to layout my directory structure so that I can store images from multiple users in a way that would be scalable when used in combination with a database. The database will store the absolute path to each image. So lets assume I was dealing with users' profile images each of which would have thumbn...

Django POST/GET exercise

I'm trying to practice some django basics by implementing my own sortable table in Django and I've run into a couple of snags. Here's the code that I'm working with in my view: def __table_view_helper__(request): if not request.session.__contains__('filters'): filters = {'filterA':'', 'filterB':'', ...

Django settings app?

Has anyone run into an idea of a "settings app" for a django project? It's a set of application variables set by an administrator (not developer, so settings.py fails) using admin panel. Are there any apps ready to use? edit I probably didn't state my question clear. I don't mean editing the things like connection settings, rather th...

Help with starting web development.

I am currently learning django, i want to be a freelancer. From what i have gathered that there is not much work in python/django on the internet and i have to get my hands on php. I want advice on what should i do? Please help me get started. Thanks in advance. ...

Django select distinct

models.py class Category(models.Model): name = models.CharField(max_length=50) def __unicode__(self): return self.name class Gender(models.Model): name = models.CharField(max_length=50) def __unicode__(self): return self.name class Post(models.Model): name = models.CharField(max_length=50) cat...

Python, Django, how to use getattr (or other method) to call object that has multiple attributes?

After trying to get this to work for a while and searching around I am truly stumped so am posting here... I want to make some functions in classes that I am writing for django as generic as possible so I want to use getattr to call functions such as the one below in a generic manner: the way I do it that works (non-generic manner): fr...

changing sql queries to nosql in django-nonrel(gae)

I have a query which looks like this: Possesion.objects.exclude(~Q(type="money") & ~Q(type="people")) I want the possessions which are of any type other than "money" and "people". Is there any easier way to do this without something like queried_possesions = POSSESION_TYPES queried_possesions.remove("money") queried_possesions.remo...

google code + temp server?

Hi, We are starting a new project to develop a website using django. We have created a project on google code. We would like to be able to occasionally show the progress of the site to some people, without having to purchase a real server. We are all modifying the project through eclipse and SVN. What's the best way to create a runser...

How can I enable anonymous comment in OSQA?

Hi all, I am wondering about how to enable anonymous posting their comments for a question in OSQA website, like stackoverflow.com does. If the OSQA does not support this feature yet, can you please give me a short brief on how can I implement a such feature like that. Thanks and best regards. ...

How can we call the CLI executables commands using Python

How can we call the CLI executables commands using Python For example i have 3 linux servers which are at the remote location and i want to execute some commands on those servers like finding the version of the operating system or executing any other commands. So how can we do this in Python. I know this is done through some sort of web...

django query using and clause

How to use and clause in Django For ex: select Date(timestamp) from userlog where (Date(timestamp) >= "2008-01-02" and Date(timestamp) <= "2009-01-02") and ipaddress != "192.168.2.211"; Django query: userlog.objects.filter(timestamp__range=(startdate,enddate),ipaddress !="192.168.2.211") In the above there is an error ...

Avoid localization of some values in django templates

I have a model with a FloatField that has to be rendered in a template without localization and another FloatField that has to be rendered with localization. How can you disable localization for certain values? ...

error on running my application in Django with mod_python

I have win32,python2.5,django1.2, apache2.2, and mod_python3.3.1 I have installed properly mod_python. Now my application name is myapp.setting which path is c:\myapp.setting. In myapp.settings my file is myapp.settings\url.py,settings.py etc. now in apache httpd.conf file I have changes following:- <Location "/mysite"> SetHandler...

how can I consume django web service in C# ?

python - django webmethod returns simplejson.dumps, how can I convert the simplejson string into C# 2.0 Object ? for example, dict -> Hashtable string -> String ... is there any JSON Serializable library in existing .NET framework or any 3rd party tool ? ...

Multiple inheritance in django. Problem with constructors

Hi, I have a model like this: class Person(models.Model,Subject): name = .. The class Subject is not supposed to be in the Database so, it doesn't extends from models.Model: class Subject: def __init__(self,**kargs): _observers = [] my problem is that the constructor of Subject is never called, so i've tried adding ...