django

django-cms lighttpd redirect domain to url

Hello, I am using djano-cms for my site, but instead of language alias /en/ /de/ I need to use another domain. I would like to avoid running multiple django instances, and instead I would like to use lighttpd redirects if possible. I would like requests coming to domain2.com getting data from domain.com/en . The best would be if the user...

CSRF error when trying to log onto Django admin page with w3m on Emacs23

I normally use Firefox and have had no problems with the admin page on my Django website. But I use Emacs23 for writing my posts, and wanted to be able to use w3m in Emacs to copy the stuff across. When I try to log into my admin pages, it gives the CSRF error: CSRF verification failed. Request aborted. Help Reason given for failure...

Is it possible to make Python etags a bit smarter with emacs?

I work on my Django project with emacs. In my virtualenv "postactivate" script I have the following simple command: find -L . -type f -name "*.py" | xargs etags -e > /dev/null 2>&1 & The TAGS file generates just fine but the system seems rather dumb. When the cursor is a model filter call, e.g. MyModel.objects.filter(...) and I hit...

Django: Inherit Permssions from abstract models?

Is it possible to inherit permissions from an abstract model in Django? I can not really find anything about that. For me this doesn't work! class PublishBase(models.Model): class Meta: abstract = True get_latest_by = 'created' permissions = (('change_foreign_items', "Can change other...

django redirect url containing id

hello, i want to add in my settings.py a declaration like: LOGIN_REDIRECT_URL='^private_profile/(?P<id>\d+)/$' #or LOGIN_REDIRECT_URL='/accounts/private_profile/id/' so that when the user with the id 1, for example,is logging in, he will be redirected to LOGIN_REDIRECT_URL='/accounts/private_profile/1/' but both alternatives, LO...

Django multilanguage support

Using django if a text is stored in French or Hindi.How will this be stored and retrieved in a text box field Models.py class Details(models.Model): title = models.CharField(max_length = 255) html page: <form action="/pjt/details"> <input type="text" name="nee_n"id="neen_n" /> </form> How to store this in the ...

how can we set safe template tag for admin change_form.html

how can we set safe template tag for admin change_form.html, I want to display HTML data instead of TextArea Input for admin form, I've a django field which is excluded in admin form, that field contains HTML data - which is dynamically generated - u can say reporting data, I want to display that HTML data with safe templatetag below t...

Modify Django admin app index

I want to change the app index page so I add help text to the models themselves, e.g. under each model I want to add help text. I know that I should override AdminSite.app_index. What is the best way to do this? ...

Using Django's memcache API on Dynamically created models.

So I have a function which creates a dynamic model. I accomplish this in a way very similar to AuditTrail (see django wiki). Sample of code is here: https://gist.github.com/0212845ae00891efe555 Is there any way I can make a dynamically-generated class pickle-able? Ideally something thats not a crazy monkeypatch/hack? ...

Django: Validation error in Admin

NEWBIE ALERT! background: For the first time, I am writing a model that needs to be validated. I cannot have two Items that have overlapping "date ranges". I have everything working, except when I raise forms.ValidationError, I get the yellow screen of death (debug=true) or a 500 page (debug=false). My question: How can I have an er...

django getting current user id

hello, i have a mini app where users can login, view their profile, and follow each other. 'Follow' is a relation like a regular 'friend' relationship in virtual communities, but it is not necessarily reciprocal, meaning that one can follow a user, without the need that the user to be following back that person who follows him. my probl...

QuerySet returning no instances of a child model

How to force QuerySet not to return instances of child models? ...

Output MySQL query results in Django shell

I have the following Django Model which retrieves 3 records from a database. The class below represents a Model within a Django application I'm building. I realize that the parameters taken in by the create_hotspots function are not being used. I just simplified what the code looked like previously for the purposes of explaining my probl...

Django: ordering numerical value with order_by

I'm in a situation where I must output a quite large list of objects by a CharField used to store street addresses. My problem is, that obviously the data is ordered by ASCII codes since it's a Charfield, with the predictable results .. it sort the numbers like this; 1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 2, 20, 21.... Now the ob...

Formset Messages

I want to be able to send a message using the new messages framework. Something along the lines of : ... if formset.is_valid return HttpResponseRedirect( some page ) messages.add_message(request,messages.INFO, '%i objects added') %formset.number_of_forms But two questions: Im not sure if i should put the messages bef...

A means to access my db in python - what is my problem afterall?

I have a remote database (at the moment sqlite, but eventually mysql) that I want to be able to call from a webpage dynamically. Basically to query for data that will populate goog viz charts etc on the page (and possibly images). I have a small, slow server that i can basically run anything on. I've also located the python lib that let...

How to loop X times in Django?

I have user reviews on my site. Each review has a rating of 1-5 stars. I want to print that many stars. How do I do it? I only see {% for X in Y %} which lets you iterate over a list, but not a certain number of times. ...

Filtering second level of Many-to-Many relations in Django

Consider three django models: AA, BB and CC. AA has an M2M reference to BB and BB has an M2M reference to CC. I have a single instance of AA. How do I execute a filter() QuerySet over the set of CC instances that are M2M related the the BB instances that are M2M related to that single AA instance? ...

Django templates: value of dictionary key with a space in it

In a Django template, is there a way to get a value from a key that has a space in it? Eg, if I have a dict like: {"Restaurant Name": Foo} How can reference that value in my template. Pseudo-syntax might be: {{ entry['Restaurant Name'] }} ...

Know of a Django / Rails enterprise level support services?

I am starting a new project for a client from the academic sector. We are trying to choose the right technology for the project and I am interested in hiring Django or Rails developers to work on it (as there will be some custom module development involved). The client wants to be able to sign up with a reliable service package after lau...