http://code.google.com/p/django-multilingual-model/
I am trying to understand how the multilanguage feature works and i found the example in the above link
What i have done is i have created a project as test and included that in settings.py
And in the test directory i have the multilingual.py and the code for this is the above said ...
What is the link to find the list of languages i.e, language_code
(Swedish,sv)
(English,en) ..........
Please provide the link
Thanks..
...
I want to save the image which as been uploaded via the PaletteGenForm as such:
#Form
class PaletteGenForm(forms.Form):
im = forms.ImageField(required=True)
#View
def palette_gen_view(request):
PATH_OF_IMAGE_TO_BE_PALETTED= MEDIA_ROOT+ "/tobesaved.png"
if request.method == 'POST':
form = PaletteGenForm(request.POST...
Can I perform in django such operation, that in one view I assign a value of return from other view, that renders its own form template and basing on it returns value ? (So in other words if on this form rendered by the other function user clicks ok, I return true, and if user clicks cancel I return false) Sample code :
Main function:
...
(13, 'Permission denied') error occurs when trying to upload an image in Django
i have checked the access rights of the directory in which image will be saved
drwxr-xr-x 2 hsrd hsrd 4096 2010-03-19 15:49 media
Please a suggest a solution for this.
if request.method == 'POST':
if 'file' in request.FILES:
file = req...
Could someone show me how i could write a login decorator like @redirect_to_home for my views so that it modifies the request.PATH variable to a new a value like / whenever it is applied to a view.
I've seen people do quite complex stuff with decorators: I'm yet to figure them out thoroughly.
Thanks
...
I am following the link http://code.google.com/p/django-multilingual-model/ Basically i am trying to insert hindi characters into mysql db
I have created the files in the test directory as in the above said link and using django version 1.1 an dpython version is 2.4.3
I geta error message as the following.
from testlanguages import ...
In my project I deal with various sorts of events taking places in different cities. I'd like to present list of events per city in a template, but how to do that ? My view now looks like this :
def events_by_state(request, state):
cities = City.objects.filter(state_slug=state)
For each city I'd like do a query :
for c in cities...
User registration in my application is performed in steps. After submitting the form, some validation is performed and then register_prompt view is called. It renders a form, with two options - 'ok' and 'cancel'. Clicking ok will run registration, and clicking cancel should redirect to main page. Problem is that no matter which of the tw...
In Django how to use unicode when inserting into DB
Example:
name =request.POST["name"] //This may be in Chinese or any other lanuages
usr = Users(name=name)
usr.save()
The Python version that is used in Cent os is python 2.4.3 and mod python version is 1.2.1_p2-1
...
from django.utils.simplejson import dumps, loads
# -*- coding: utf-8 -*-
def index(request):
return render_to_response('test2/index.html')
def add_lang(request):
logging.debug("Got request")
a = request.POST
logging.debug(a["lang"])
lang=dumps(a["lang"])
l = Language(code=lang)
l.save()
lang=loads(lang)
lo...
I have the following models:
class Order_type(models.Model):
description = models.CharField()
class Order(models.Model):
type= models.ForeignKey(Order_type)
order_date = models.DateField(default=datetime.date.today)
status = models.CharField()
processed_time= models.TimeField()
I want a list of the order types tha...
Hi,
I keep getting this error on my views. I can't work it out as the code is similar to the djangos tutorial just changing the objects name. Here is the code for my views.py:
from django.http import HttpResponse
from django.template import Context, loader
from django.shortcuts import render_to_response
from astonomyStuff....
I was just trying to convert a PPT using the following URL http://code.google.com/p/qifei/wiki/PDFConverter python code
I could see the same thing happening with the command line option too
python documentconverter.py /home/rajeev/Desktop/Downloads/Industry2.ppt /home/rajeev/Desktop/test.pdf
It appears that the image overlaps on some ...
If csv file has rich text in it. Using csv.reader() can the same format stored in the Mysql database using django and retrieved back to html pages?
Thanks..
...
What is wrong with the following code for file uploading.The request.FILES['file'] looks empty
Models:
from django.db import models
from django import forms
class UploadFileForm(forms.Form):
title = forms.CharField(max_length=50)
file = forms.FileField(label="Your file")
Views:
def index(request):
if request.m...
I have a model like this:
class database(models.Model):
db_name = models.CharField('Name', max_length=20)
server = models.ForeignKey(dbServer, unique=True)
user = models.ForeignKey(User)
In my view I want to grab every database realated to the current user (has to be logged in at that point).
I'm sure there is an easy way to do ...
I have a list of items that looks like this: 'Item 1', 'Item 2', 'Item 3'... with the list being dynamic in length.
My question is how can I pass this variable to my view?
Edit 1
Just thought I'd clarify what I was attempting:
return HttpResponseRedirect(reverse('newFeatures',
kwargs={'stock_number': stock_number, 'new_feature...
This may not be relevant but just wanted to ask,
IF an object is passed from views to template and in the template will i be able to query many to many fields
Models code:
class Info(models.Model):
xls_answer = models.TextField(null=True,blank=True)
class Upload(models.Model):
access = models.IntegerField()
info ...
I am working on an app which would enable a preview function for a model. Models marked as preview-able would allow for changes to be made in the Django admin interface and previewed on site using the same view as would an object of that type normally use to render itself, but rendered instead with the new (unsaved) object in it's place....