Re: ImproperlyConfigured: Requested setting USE_I18N, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before access

2013-04-25 Thread Iftikhar Ali


> but while testing and pychecker i am getting this error how should i 
> configure DJANGO_SETTINGS_MODULE
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Calling Jquery or javascript function based on an if condition

2013-04-25 Thread Iftikhar Ali
yes brother you can it is very easy
just put your condition in and if
you should have to know how the if condition is working in django templates


{% ifequals comparator1 comparator2 %}

call javascript function from here

{% end ifequals %} 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: I encountered a core exception and need help configuring for a database. My OS is Ubuntu 12.10 32 bit

2013-04-25 Thread Iftikhar Ali

>
>  buddy i am also getting the same error... if you have so far got the 
> answer please help me too...
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




ImproperlyConfigured: Requested setting USE_I18N, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing

2013-04-25 Thread Iftikhar Ali
when i am running the project it is running perfectly fine but when i am 
trying to open django-admin.py shell the error:

ImproperlyConfigured: Requested setting USE_I18N, but settings are not 
configured. You must either define the environment variable 
DJANGO_SETTINGS_MODULE or call settings.configure() before accessing 
settings.

is generated. Not only when opening the django-admin.py shell but also when 
testing and using pychecker. 
i follow the doc.djangoproject and opened the python shell and append the 
projectname.setting to  the sys.path. when i import first time it is ok but 
when i come out of python shell and re enter to the shell the 
projectname.setting is missing from the sys.path

i am totally blank what is going on around here can any body have the 
solution for this thanks in advance you guyz..

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




how to save manytomany relation data to database through form....

2013-03-02 Thread Iftikhar Ali
i am having one tag class and one user in which user contained a tag 
element which has manytomany relation with tag class

can you guyz tell me how to save this tag using form

i attached the form.py model.py and view.py

my problem is the tag element i can't access through the form and don't 
understand how to save it... i tried lot's ya can you guyz help.

thanx in advance.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


from django import forms
from application.homepage.models import Tag

class RegistrationForm(forms.Form):
	name = forms.CharField()
	dob = forms.DateTimeField()
	email= forms.EmailField()
	alternate_email=forms.EmailField()
	permission=forms.DecimalField()
	password = forms.CharField()
	phone=forms.DecimalField()
	#pic = forms.ImageField()
	about= forms.CharField(widget=forms.Textarea)
	profile_view= forms.DecimalField()
	location= forms.CharField(widget=forms.Textarea)
	website = forms.CharField()
	reputation=forms.DecimalField()#tags= forms.CharField(widget=forms.CheckboxSelectMultiple(choices=choice))
	tags= forms.ModelMultipleChoiceField(queryset=Tag.objects.all(),widget=forms.SelectMultiple())
	num_of_que_asked= forms.DecimalField()
	num_of_que_answered= forms.DecimalField()
	doj = forms.DateField(widget=forms.DateInput)from thumbs import ImageWithThumbsField
from django.db import IntegrityError
from django.db import models

class  Tag(models.Model):
	name = models.CharField(max_length=64, primary_key=True)
	about= models.TextField()
	created_date =  models.DateTimeField(auto_now_add=True)
	editor = models.CharField(max_length=64)
	active= models.BooleanField()
	verified= models.BooleanField()
	rating= models.DecimalField(max_digits=8,decimal_places=0)
	date_modified = models.DateTimeField(auto_now_add=True)
	def __str__(self):
		#return (self.name,self.about,self.created_date,self.editor,self.active,self.verified,self.rating,self.viewed,self.date_created)
		return (self.name)
	class Admin:
		pass

class User(models.Model):
	name = models.CharField(max_length=64)
	dob = models.DateTimeField(auto_now_add=True)
	email= models.EmailField(verbose_name='your e-mail')
	alternate_email=models.EmailField()
	permission=models.DecimalField(max_digits=3,decimal_places=0,blank=True, null=True)
	password = models.CharField(max_length=32)
	phone=models.DecimalField(max_digits=11,decimal_places=0)
	pic = ImageWithThumbsField(upload_to='images',blank=True, null=True)
	about= models.TextField()
	profile_view= models.DecimalField(max_digits=8,decimal_places=0)
	location= models.TextField()
	website = models.URLField(max_length=64)
	reputation=models.DecimalField(max_digits=3,decimal_places=0,blank=True, null=True)
	tags= models.ForeignKey(Tag, blank=True, null=True)
	num_of_que_asked= models.DecimalField(max_digits=8,decimal_places=0)
	num_of_que_answered= models.DecimalField(max_digits=8,decimal_places=0)
	doj = models.DateTimeField(auto_now_add=True)
	def __str__(self):
		#return (self.name,self.dob,self.email,self.about,self.profile_view,self.location,self.website,self.tags,self.num_of_que_asked,self.num_of_que_answered,self.doj)
		return (self.name)
	class Admin:
		pass
	
	
	


class Tips(models.Model):
	heading = models.CharField(max_length=64)
	description= models.TextField()
	verified= models.BooleanField(blank=True)
	creation_date = models.DateTimeField(auto_now_add=True)
	modified_date = models.DateTimeField(auto_now_add=True)
	tags = models.ManyToManyField(Tag)
	active= models.BooleanField(blank=True)
	created_by = models.CharField(max_length=64)
	rating= models.DecimalField(max_digits=8,decimal_places=0)
	viewed= models.DecimalField(max_digits=8,decimal_places=0,blank=True, null=True)
	def __str__(self):
		#return (self.heading,self.about,self.verified,self.creation_date,self.modified_date,self.tags,self.created_by,self.rating,self.viewed)
		return (self.heading)
	class Admin:
		pass# Create your views here.
from django.shortcuts import render_to_response, get_object_or_404
from application.homepage.models import Tips,User,Tag
from django.http import HttpResponse
from django.template import RequestContext
from application.homepage.forms import RegistrationForm

def index(request):
	userlist=Tips.objects.all()
	mrel=userlist[0].tags.all()
	return render_to_response('homepage/index.html',{'userlist':userlist, 'mrel':mrel})
	
	
def register(request):
	
	if request.method == 'POST':
		reg_form=RegistrationForm(request.POST, request.FILES)
		taglist=[]
		print "working"
		if reg_form.is_valid():
		  success=True
		  try: