How to restrict the number of file upload sessions, so as to avoid Denial of Service attacks?

2010-05-24 Thread laspal
Hi, How can I restrict the number of file upload sessions. Say suppose I want only 100 user at any instant of time and I also there is no problem of Denial of Service attacks. Thanks. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to

How to restrict the size of file being uploaded apache + django

2010-05-24 Thread laspal
Hi, How to restrict the size of file being uploaded. I am using django 1.1 with apache. Can I use apache for this and show some html error page if say size is bigger then 100MB. I can use LimitRequestBody for restricting the file size in apache, My problem is I wanted to show some error page if

How to pass 2 list as one in template

2009-05-28 Thread laspal
Hi, I have 2 list and want to iterate as one in template. How can I do it. example-> list1 = [10,20,30,30] list2 = [aa,bb,cc,dd] {% for item in list1 and item1 in list2 %} {{item}} {{item1}} {% endfor%} {% endfor %} which is wrong. How can I fix this. I cant do this: {% for item in list1 %} {%

HttpResponseRedirect problem

2009-05-24 Thread laspal
Hi, I have a form with 2 buttons. depending on the button click user is taken to different url. view function is : friend_id = request.POST.get('selected_friend_id_list') history = request.POST.get('statushistory') if history: print "dfgdfgdf" return

Best way to filter my query in calendar format.

2009-05-22 Thread laspal
Hi, My DB looks lie: id date msg 2011-2-09 abcd 2015-2-09 abcd 20 20-2-09 abcd 20 1-3-09abcd 20 5-3-09

How to convert 10 digit mysql date to django date format

2009-05-22 Thread laspal
Hi, How to convert mysql 10 digit date format to django date format? example: mysql date - 1219848914 to django date - "22-05-09" thanks. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To

need help for using counter inside for loop

2009-05-20 Thread laspal
Hi, Hi, my_date_list = ['01', '02', '03','04','05','06','07','08','09','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31'] str_date_list=[] for item in my_date_list: str_date_list.append(item+'-'+'05' + '-' +'09') counter= 0 i =

Need help for nested list in template

2009-05-19 Thread laspal
Hi, My model is : id val msg 20 1234 text 20 1245text 20 1275 text 20 1356

how to use filter

2009-05-18 Thread laspal
Hi, class Status(models.Model): someid = models.IntegerField() value = models.IntegerField() status_msg = models.CharField(max_length = 2000) so my database look like: 20 1234567890 'some mdg' 20 4597434534 'some msg2' 20 345394593'sdfgsdf' 10 450348534

need help for facebook app

2009-05-15 Thread laspal
hi, I am trying to write a facebook app where user can see the status history of his friends. Everything seems to work fine until I try to save the status information in my DB. here is code : class UserStatus(models.Model): facebookid = models.IntegerField() time = models.IntegerField()

how to use facebook api in django

2009-05-12 Thread laspal
hi, I am trying to get status msg of the user in my facebook app. But getting error in loading page. here is the code: user, created = FacebookUser.objects.get_or_create(id = request.facebook.uid) key = request.facebook.session_key some =

Need help for using facebook api

2009-05-11 Thread laspal
Hi, I am trying to build facebook app but ran into problem. here is the code: from django.http import HttpResponse from django.views.generic.simple import direct_to_template import facebook.djangofb as facebook from fblaspal.models import FacebookUser @facebook.require_login() def

looking for working example of mptt

2009-02-09 Thread laspal
hi, Does anyone has a working example of django mptt. I am not able to implement it. Thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

problem with paginated page having checkbox

2008-12-09 Thread laspal
hi, I am trying to get list of selected checkbox from the listing. here is my code: html {% for companies in companylist.object_list %} {% endfor %} {% if is_paginated %} Prev | Page {{cur_page}} of {{paginator_company_list.num_pages}} | Next {% endif %} and

Re: Need help for sorting

2008-11-28 Thread laspal
Young <[EMAIL PROTECTED]> wrote: > On Nov 25, 12:27 am,laspal<[EMAIL PROTECTED]> wrote: > > > Exception Type: FieldError > > Exception Value:Cannot resolve keyword 'callreports_meetingdate' > > into field. > > Your error indicates a missing mod

Re: Need help regarding form

2008-11-26 Thread laspal
Any one??? On Nov 25, 4:09 pm, laspal <[EMAIL PROTECTED]> wrote: > Hi, > > ***view > company_list = Company.objects.order_by('name') > selected_companies_id_list = request.POST.getlist > ('selected_companies_id_list') > companies_li

Need help regarding form

2008-11-25 Thread laspal
Hi, ***view company_list = Company.objects.order_by('name') selected_companies_id_list = request.POST.getlist ('selected_companies_id_list') companies_list =[] for company_id in selected_companies_id_list: company = Company.objects.get(id = company_id)

Re: Need help for sorting

2008-11-24 Thread laspal
No It give me error Exception Type: FieldError Exception Value:Cannot resolve keyword 'callreports_meetingdate' into field. Thanks. On Nov 25, 12:21 pm, Donn <[EMAIL PROTECTED]> wrote: > On Tuesday, 25 November 2008 09:11:36 laspal wrote: > > > sortby = callr

Need help for sorting

2008-11-24 Thread laspal
Hi, Code : ***Model** class Company(models.Model): name = models.CharField( max_length=100) created_on = models.DateTimeField(auto_now_add=True) updated_on = models.DateTimeField( auto_now = True) class CallReport(models.Model): company =

Help for crontab

2008-11-20 Thread laspal
hi, I am writing cron job for my application but run into problem from django.core.management import setup_environ import settings setup_environ(settings) from test.crm.models import CronEmail Basically the problem is I am not able to import any model. I tried this too: pathname =

Re: File field problem

2008-11-20 Thread laspal
Got it fixed. I was making mistake -) On Nov 20, 12:22 pm, laspal <[EMAIL PROTECTED]> wrote: > OK I got the point but still having some problem dealing with excel > file. > > code: > abspath = '/home/laspal/work/test/tmp/' > * view*** > if not

Re: File field problem

2008-11-19 Thread laspal
OK I got the point but still having some problem dealing with excel file. code: abspath = '/home/laspal/work/test/tmp/' * view*** if not os.path.isdir(abspath + str(_user.username)): os.mkdir(abspath + str(_user.username) ) filepathwithname

File field problem

2008-11-18 Thread laspal
('/home/laspal/work/test/', 'static/media') MEDIA_URL = '/static/media/' ***view** emailform = SendMailForms(request.POST, request.FILES) cronemail = CronEmail() attach = request.FILES['attach'] cronemail.subject = subject and so on cronemail.save() So my

Re: Cron job help..

2008-11-14 Thread laspal
Ok I got the point but I run into some other problem. when I run python /home/laspal/test/test.py It run without giving any error. but when I do crontab -e and add the file -> */5 * * * * /home/laspal/work/ibms/triget_mail.py > /tmp/foo.log 2>&1 and go to /tmp/foo.log I am

Cron job help..

2008-11-14 Thread laspal
Hi, I am trying to write cron job for trigger mail whenever task is overdue. Here is the code for simple sending mail. import sys import os def setup_environment(): pathname = os.path.dirname(sys.argv[0]) sys.path.append(os.path.abspath(pathname))

[Errno 13] Permission denied while using apache2

2008-11-12 Thread laspal
hi, I am trying to create folder. here is the code: if not os.path.isdir(str(_user.username)): os.mkdir(str(_user.username) ) filepathwithname = os.path.join(str(_user.username), file_name) if not os.path.isfile(filepathwithname):

Re: Problem with pyExcelerator and response

2008-10-31 Thread laspal
So how can I fix it. I am not able to fix it. Thanks On Oct 30, 4:26 pm, Steve Holden <[EMAIL PROTECTED]> wrote: > laspalwrote: > > Any one can help me out. > > Thanks. > > > On Oct 29, 11:41 am,laspal<[EMAIL PROTECTED]> wrote: > >> Hi, > >>

Re: Problem with pyExcelerator and response

2008-10-30 Thread laspal
Any one can help me out. Thanks. On Oct 29, 11:41 am, laspal <[EMAIL PROTECTED]> wrote: > Hi, > I am trying to create Excel file usingpyExceleratorbut my problem is > I am not able > to attach file to response. > > code : > workbook = Workbook() > worksheet

Problem with pyExcelerator and response

2008-10-29 Thread laspal
Hi, I am trying to create Excel file using pyExcelerator but my problem is I am not able to attach file to response. code : workbook = Workbook() worksheet = workbook.add_sheet('My Test Sheet') worksheet.write(0,0, 'Company', font_style('left', 1, 'red')) worksheet.write(1,1,

Re: pdf file generated problem

2008-10-07 Thread laspal
d do it like this: > try: > > except: > logging.error('...') > raise # reraise exception > > - Why do you use HttpResponse for the canvas? You could use cStringIO or > a tempfile. > > - Please post the traceback, if you ask for help. It shows where the >

pdf file generated problem

2008-10-07 Thread laspal
Hi, I am trying to generate pdf file and send the generated file by mail to the user. But I am getting value error as I am not sure how to attach file. here is my view function: def companies_report(request, companyid): _user = request.user sender = _user.email company =

MultiValueDictKeyError for attach = forms.FileField(required=False)

2008-10-03 Thread laspal
Hi, I am getting MultiValueDictKeyError -> Exception Value: "Key 'attach' not found in " I have made filefield as required false but in the form when attach field is empty I am getting above error.. but when all the fields are filled its work fine. Can someone help me out why I am

Re: How to process 1 form data to another form??

2008-09-30 Thread laspal
>>In other words, why can't you just call it directly as a Python function and >>pass it the list of mail ids you want to send? I tried returning the python function. View contact( request): if request.method == 'POST': return SendMail_Selected(request, new_mailing_list) view

How to process 1 form data to another form??

2008-09-30 Thread laspal
Hi, I have a listing of contact from which I choose contact and get the mailid. Now I want to send mail to the selected mailid by using another form. So right now what I am doing is : view contacts( request): if request.method == 'POST': return

name '_' is not defined

2008-09-23 Thread laspal
Hi, I am using 1.0 version ran into problem. My model : from django.db import models from django.contrib.auth.models import User IPSecurity = True class IPAccess(models.Model): ip = models.IPAddressField(_('ip'), unique=True, db_index=True) location = models.CharField(max_length

Error in : Porting your apps from Django 0.96 to 1.0

2008-09-23 Thread laspal
Hi, I am trying to port my apps from django 0.96 to 1.0. I have made all the changes required for it but when I run /usr/bin/python manage.py runserver I am getting error : Error: Can't find the file 'settings.py' in the directory containing 'manage.py'. It appears you've customized things.

problem with send_mail

2008-09-22 Thread laspal
hi, My view function is: _user = request.user sender = _user.email contact_list =Contact.objects.all() mailing_list = [] if request.method != 'POST': emailform = EmailForm() return render_to_response('email.html', locals()) if request.method == 'POST':

'unicode' object has no attribute 'user'

2008-09-18 Thread laspal
Hi, I am trying to send mail using sendmail. Getting the error 'unicode' object has no attribute 'user' My view function: def send_mail(request): _user = request.user sender = _user.email mailing_list = [] if request.method != 'POST': emailform = EmailForm()

Re: ImportError: cannot import name EmailMessage

2008-09-18 Thread laspal
So is there any way of attachment to mail using send_mail() in 0.96 version On Sep 18, 11:24 am, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Wed, 2008-09-17 at 23:23 -0700, laspal wrote: > > Hi, > > I am using 0.96 version of django and I am not able to import &g

ImportError: cannot import name EmailMessage

2008-09-18 Thread laspal
Hi, I am using 0.96 version of django and I am not able to import EmailMessage. I have to send attachment with the mail and for that I am using EmailMessage but not able to import it. Does any one has a idea how to do it. here is my code: if emailform.is_valid(): subject =

Re: How to attach file with send mail

2008-09-17 Thread laspal
Which documentation are you talking about?? On Sep 17, 3:49 pm, Erik Allik <[EMAIL PROTECTED]> wrote: > A few months ago I had a similar need and I believe the documentation > helped me out. > > Erik > > On 17.09.2008, at 11:23, laspal wrote: > > > > > Hi

How to attach file with send mail

2008-09-17 Thread laspal
Hi, I wanted to know how I can attach a file while sending mail to the user. Sending mail is working fine but now I have to send a file with a mail. What are the things I have to use?? --~--~-~--~~~---~--~~ You received this message because you are subscribed to

Sorting problem with model having ForeignKey and ManyToManyField

2008-08-20 Thread laspal
hi, I am trying to sort my tables depending upon the header. Its working fine if my models does have any ForeignKey or ManyToManyField. but if its does sorting is not working. class Meeting(models.Model): created_by = models.ForeignKey(User, blank=True, null=True) meeting_desc =

Re: How to tiger mail

2008-08-19 Thread laspal
Can anyone give a link for doing corn job. Thanks On Aug 19, 4:43 pm, Jarek Zgoda <[EMAIL PROTECTED]> wrote: > Wiadomość napisana w dniu 2008-08-19, o godz. 13:31, przez laspal: > > > > > hi, > > I wanted to know how can I automatically tiger mail if some task

How to tiger mail

2008-08-19 Thread laspal
hi, I wanted to know how can I automatically tiger mail if some task is overdue by 1 day. I have idea of using send_mail but wanted to send mail when the task is overdue... Thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the

check box problem

2008-08-19 Thread laspal
hi, My modes is : class Company(models.Model): name = models.CharField( maxlength=100) met_by = models.CharField(null=True, maxlength=200) primary_contact = models.IntegerField(null=True, blank=True) business_overview = models.TextField(null=True, maxlength = 2000 )

object is unindexable

2008-07-16 Thread laspal
Hi, I am getting the error "object is unindexable" code : company = Company.objects.get( id = companyid) for ss in company.financials.all() : ss[1].year ss[1].revenue ss.year and ss.revenue gives me the correct values for the entire list but I am want to get only the first one.?

how to seperate view file into different files

2008-07-07 Thread laspal
Hi, I have a app called crm in which I have (model.py, views.py , forms.py, urls.py and __init__.py) Now the problem is my code has become too big to handle in 1 file. So I wanted to know how can I separate my views.py into multiples files. My models is as follows: Industry: Deals:

Re: testing login problem

2008-07-03 Thread laspal
Hey I am able to run the test by using : class IndustryTest(TestCase): fixtures = ['/fixtures/initial_data.xml'] def setUp(self): self.client = Client() response =self.client.post('/ibms/login/', {'username':'laspal', 'password':'abcd'}) def test_addIndustry( self

Re: testing login problem

2008-07-03 Thread laspal
Hey I am able to run the test by using : class IndustryTest(TestCase): fixtures = ['/fixtures/initial_data.xml'] def setUp(self): self.client = Client() response =self.client.post('/ibms/login/', {'username':'laspal', 'password':'abcd'}) def test_addIndustry( self

Re: testing login problem

2008-07-03 Thread laspal
() response =self.client.post('/ibms/login/', {'username':'laspal', 'passwords':'abcd'}) print response test case is as follows: Loading 'initial_data' fixtures... Installing xml fixture 'initial_data' from '/home/laspal/work/ibms/../ ibms/crm/fixtures'. Installing xml fixture

Re: testing login problem

2008-07-02 Thread laspal
ttest from django.test import TestCase class IndustryTest(TestCase): def setUp(self): self.client = Client() response =self.client.post('/ibms/login/', {'username':'laspal', 'passwords':'abcd'}) print response I am still getting the error."""Your user

Re: testing login problem

2008-07-01 Thread laspal
> More info here:http://www.djangoproject.com/documentation/testing/ > > On Jul 1, 5:51 pm, laspal <[EMAIL PROTECTED]> wrote: > > > Hi, > > > I am writing the test case but I am getting errors. > > > Test case is as follows: > > > import unittest &g

testing login problem

2008-07-01 Thread laspal
): self.client = Client() response =self.client.post('/ibm/login/', {'username':'laspal', 'password':'abcd'}) print response Getting error : Your username and password didn't match. Please try again. Username : Password : So

Unit test problem

2008-06-26 Thread laspal
hi, I am writting unit test for the views. class IndustryTest(unittest.TestCase): def setUp( self): self.client = Client() self.client.post('/ibm/login/', {' usrename' :'admin', 'password' : 'abcd'}) def test_addIndustry( self): url = '/ibm/crm/industries/add/'

how to sort in django template

2008-06-18 Thread laspal
hi, I have a list of employee and i want to sort it. Employee( this is my header) under which i have list of employee. So now my question is on clicking employee header I want to change the list. Like it happens for user in django admin. Please help me out. Thannks.

How to pass a function with argument in template

2008-06-12 Thread laspal
Hi, I have a model in which i have a function class somemodel(models.Model) def greater( self, num1, num2) : if num1 > num2: return True else: return False In view function I am passing: abcd = somemodel.object.all() and in template i want to use greater function, How can I use it.

Url pattern problem

2008-05-13 Thread laspal
hi, my project is as follows. project.app.candidate url patter are as follows: urlpatterns = patterns('', (r'^project/app/', include('project.app.urls')) for app it is: urlpatterns = patterns('', (r'^candidateprofile/',

Auto fill the form field???

2008-04-23 Thread laspal
Hi, I have a form with the following field. 1)Title 2)Descriptions 3) No of person 3) Drop down box containing the previous filled form title.. Now my question is how to auto fill the form field when a user choose any title from the drop down box. I am doing that so that user can choose any

username password mismatch problem

2008-04-15 Thread laspal
hi, {% blocktrans with form.errors as err %} {{ err }}{% endblocktrans %} for my login page gives me __all__ * username password mismatch or does not exist.. I wanted to know how to display only * username and password does not exist. I dont want to show __all__ ... Thanks.

Re: how to convert {{candidate.vote_set.filter(vote='TU').count()}} in template syntax

2008-03-28 Thread laspal
Thanks a lot. Its works On Mar 27, 8:33 pm, Peter Rowell <[EMAIL PROTECTED]> wrote: > Specifically, you might look athttp://www.djangosnippets.org/snippets/9/. > > This allows you to do something like: > > {% expr candidate.vote_set.filter(vote='TU').count() as count %} > > and now

Re: Could not parse the remainder in Template?

2008-03-27 Thread laspal
Thanks .. On Mar 27, 1:15 pm, "James Bennett" <[EMAIL PROTECTED]> wrote: > On Thu, Mar 27, 2008 at 1:12 AM, django <[EMAIL PROTECTED]> wrote: > > How do i convert {{ candidate.vote_set.filter(vote='TU').count()}} in > > my view_candidate to work it properly > > Right now it give me

Re: how to convert {{candidate.vote_set.filter(vote='TU').count()}} in template syntax

2008-03-27 Thread laspal
Thanks a lot.. On Mar 27, 2:03 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Alternatively you can create a templatetag to accomplish this. > > On Mar 27, 3:14 am, "Russell Keith-Magee" <[EMAIL PROTECTED]> > wrote: > > > On Thu, Mar 27, 2008 at 3:52 PM, django <[EMAIL PROTECTED]> wrote: >

Template not getting render after login

2008-01-29 Thread laspal
Hi, I have a base template with with tabs like create user, edit user and so on. My base.html is as follows: View User Create User Edit User

Re: Loading Template

2008-01-17 Thread laspal
quot;Karen Tracey" <[EMAIL PROTECTED]> wrote: > > > On Jan 17, 2008 2:32 AM, laspal <[EMAIL PROTECTED]> wrote: > > > > Hi, > > > I wanted to know how can I load template without adding any > > > functionality to it. > > > Ba

Loading Template

2008-01-16 Thread laspal
Hi, I wanted to know how can I load template without adding any functionality to it. Basically I just wanted to see how does my template looks. MY view.py is : from django.template.loader import get_template from django.template import Context def Main_Page(request): t =

Re: Problem with Css and django template

2008-01-15 Thread laspal
"James Bennett" <[EMAIL PROTECTED]> wrote: > > > On Jan 15, 2008 1:08 AM, laspal <[EMAIL PROTECTED]> wrote: > > > This: > > > > (r'^static/(?P.*)$', 'django.views.static.serve', > > > {'document_root': '/home/laspal/trytemplate/Templ

Re: Problem with Css and django template

2008-01-15 Thread laspal
Hi, I am still not able to fix it. Can u please let me know what should my should be depending upon the url. Do I have to make any change in my setting.py file. Thanks. On Jan 15, 1:00 pm, "James Bennett" <[EMAIL PROTECTED]> wrote: > On Jan 15, 2008 1:08 AM, laspal <[E

Problem with Css and django template

2008-01-14 Thread laspal
import * from django.conf import settings urlpatterns = patterns('', (r'^time/$', current_datetime), (r'^static/(?P.*)$', 'django.views.static.serve', {'document_root': '/home/laspal/trytemplate/Template/', 'show_indexes' : True}), ) if settings.DEBUG: urlpatterns += patterns