Re: template problem in windows

2007-10-08 Thread Dushyant Sharma

yes thanks mike

mostly i work in linux but i had to see some work on windows and this
problem was little strange. but all well now.
thanks again


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



template problem in windows

2007-10-08 Thread Dushyant Sharma

i have found this during working with django on windws.
if i create folder like template, backup (start characters t, b etc)
it wont work because template folder settings in the SETTINGS.py will
be
TEMPLATE_DIRS = (
 'c:\myproject\template',
}

it would not work because \t is tab character and it would render a
tab in the path resulting in template not found exception.
similarly other executable characters like \b for bell etc. would
result in  template not found exception.

a solution for it can be escaping the executable character so instead
of using \t using \\t would work
TEMPLATE_DIRS = (
 'c:\myproject\\template',
}

it's not a problem at all in linux.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Data truncated for column 'text' at row 1

2007-09-28 Thread Dushyant Sharma

the problem seems to be your database installation. you can increase
CharField length by installaing mysql version 5.xx.
also check what database you are using and character set it supports.

On Sep 25, 10:42 am, Sebastian Dahlgren <[EMAIL PROTECTED]>
wrote:
> Hi!
> I have built my site on the Django dev server and everything works
> fine there. But when I uploaded the project to a Apache + mod_python
> server I got an error
>
> Data truncated for column 'text' at row 1
>
> That is shown when I pass swedish chars like å ä and ö into a form,
> which then POST's the form back to the same page.  The whole warning-
> message reads:
>
> Warning at /
> Data truncated for column 'text' at row 1
> Request Method: POST
> Request URL:http://sql.bidclub.se/
> Exception Type: Warning
> Exception Value:Data truncated for column 'text' at row 1
> Exception Location: /usr/lib/python2.4/site-packages/MySQLdb/
> cursors.py in _warning_check, line 80
> Python Executable:  /usr/bin/python
> Python Version: 2.4.4
>
> The POSTing works 'cause when I return to the site I can see the post.
> I guess this has something to do with unicode or something, but I
> don't really know where to look.
>
> Any hint is really appreciated!
>
> Thanks in advance


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: changing settings.py

2007-09-28 Thread Dushyant Sharma


you can try adding
MaxRequestsPerChild 1
to your httpd.conf file and restart apache
then i think you dont' need to restart apache every time.
this is just for testing purpose, for more read documentation on it.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



run queries stored in database

2007-09-28 Thread Dushyant Sharma

can we save django ORM queries in database and execute them later.

suppose i have  class
class queries():
  qry=models.CharField(maxlength=200)

and i save a query "test.objects.filter(id=5)" in qry

now want to run query stored in qry field


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



problem organizing queries

2007-09-27 Thread Dushyant Sharma

hi i am having problem with relating objects. i have models as below

class support():
   suptype = models.CharField(maxlength=255)

class DispMaster():
dmtype=models.ForeignKey(support)

class DataDispMaster():
ddmmaster=models.ForeignKey(Master)

class Master():

class DataMaster():
   dmmaster = models.ForeignKey(Master)

i want to get one row from support table,
get its related entry from DispMaster table,
get multiple entries from DataDispMaster table related to DispMaster
table,
get multiple entries from Master table related to DataDispMaster
table,
finally get values from DataMaster table related to Master table

this is what i have done so far (i really don't think it is good
enough)
supid=support.objects.filter(suptype="Basic") #this will
return one row only
dispmid=DispMaster.objects.filter(dmtype=supid[0].id)#this also
will return only one row
mid = Master.objects.filter(datadispmaster__ddmmaster__exact =
dispmid[0].id)  #this is where i am getting problems because i will
get multiple values from here which again will be used in the next
query to get further values.

now i want values from DataMaster table respective to the values i
have got in previous table.

i have also read the discussion going at
http://groups.google.co.in/group/django-users/browse_thread/thread/91985e7ca5ad7c8c?hl=en#

i still figuring it out if django ORM support this type of query. and
if not what is the best way to overcome this problem.
one way i think is to get the dictionary for mid object
(mid.values('id')) and convert the dictionary to list and use ORMs
IN function. but this, i dont' think, is good solution

if any body can help me to organize these queries


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: url config problem

2007-09-27 Thread Dushyant Sharma


i think you are using windows.
try adding "MaxRequestsPerChild 1"  (without quotes)  to
httpd.conf,
you can change this setting later after reading how apache handles
requests. i think that wouldn't be required for you now.
also put your application to the python path (you can try initial
application at "site-packages" folder inside python folder)
check your files for sample application
urls.py
(r'^mysite/admin/', include('django.contrib.admin.urls')),
notice "mysite/admin/"
where mysite is url you have defined at httpd.conf
   notice "/mysite"you can
read further on it
 SetEnv DJANGO_SETTINGS_MODULE mysite.settings


i have seen same problem on windows and following these steps, i have
eliminated the problem.



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: url config problem

2007-09-27 Thread Dushyant Sharma

which os you are using??
is your site-packages directory under system path??
and can you paste lines from httpd.conf, urls.py and settings.py where
you have made modifications.

On Sep 26, 6:49 pm, swati <[EMAIL PROTECTED]> wrote:
> I have configured httpd.conf, you can look at it 
> athttp://82.165.180.35:8088/djproject/
> I can see the first django page. Could not run any application when I
> try to do that by editing urls.py file.
>
> Thanks,
> Swati
>
> On Sep 26, 1:27 pm, Dushyant Sharma <[EMAIL PROTECTED]> wrote:
>
> > i think you have not configured httpd.conf and this is why apache can
> > not identify the request.
>
> > read this pagehttp://www.djangoproject.com/documentation/modpython/
>
> > also make entry in httpd.conf
> > LoadModule python_module /usr/local/apache2/modules/mod_python.so (for
> > linux)
> > for windows use your windows installation path


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: url config problem

2007-09-26 Thread Dushyant Sharma


i think you have not configured httpd.conf and this is why apache can
not identify the request.

read this page
http://www.djangoproject.com/documentation/modpython/

also make entry in httpd.conf
LoadModule python_module /usr/local/apache2/modules/mod_python.so (for
linux)
for windows use your windows installation path


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: response from another function

2007-09-18 Thread Dushyant Sharma

> function1(request):
> return function2(request)

no i just want that function2(request) call makes a permanent redirect
(not HttpResponseRedirect, i dont want more burden on urls.py) to
function2 and all the response should be sent from function2 only. it
should never come back to function1 again. if it is possible


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



response from another function

2007-09-18 Thread Dushyant Sharma

is it possible to return HttpResponse from another function

like i have called a function say furnction1(request) and now is it
possible

function1(request):
  #normal statements
  #here i call another function
  function2(request)
  return HttpResponse('bye') #just for example not useful here

function2(request):
  return HttpResponse('ok')


here it will return 'bye' but i want that the function call for
function2 should return 'ok' to the client browser


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How to run server after install Django

2007-09-18 Thread Dushyant Sharma

dear Han
you must add path of python.exe,  django-admin.py and manage.py to
your system path
you should avoid copying system files here and there as it will cause
problems.

clean approach should be
1. install python  (say installed at C:\python25)
2. set path for python.exe
3. install django (will be installed at c:\python25\lib\site-packages)
4. add django-admin.py and manage.py (complete path) to system path
5. create a new folder (just to manage your applications) (say c:
\djangoapps)
6. inside c:\djangoapps use command django-admin.py
startproject mysite
7. it will create new folder mysite inside c:\djangoapps
8. here you can run server manage.py runserver
and you are ready to work


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



size of urls.py

2007-09-14 Thread Dushyant Sharma

is there any performance bottleneck when the size of urls.py goes
large.
if yes how to overcome that.
also if we use same url for a particular group, based on some hidden
action variable in htmls, would it improve performance. like i am
using

if request.method == 'POST':
action = request.POST['act']
if action == '0001':
 call some function based on action 0001


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: User session variable in view

2007-09-14 Thread Dushyant Sharma

use RequestContext
http://www.djangoproject.com/documentation/templates_python/#subclassing-context-requestcontext
pass request object to it
c= RequestContext(request, {other objects})
then you can use user.fieldname in your view


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Uploading files

2007-09-14 Thread Dushyant Sharma


class ThingForm(forms.Form):
name = forms.CharField(max_length=30, required=True, label=_('Name
of the thing'))
photo = forms.Field(widget=forms.FileInput, required=False,
label=_('Photo'), help_text=_('Upload an image (max %s kilobytes)' %
settings.MAX_PHOTO_UPLOAD_SIZE))

def thing_add(request):
if request.method == 'POST':
new_data = request.POST.copy()
new_data.update(request.FILES)
form = ThingForm(new_data)
if form.is_valid():
clean_data = form.clean_data
t = Thing()
t.name = clean_data['name']
if clean_data['photo']:
photo = clean_data['photo']
t.save_photo_file(photo['filename'], photo['content'])

please also read
http://www.djangoproject.com/documentation/model-api/#filefield
and
http://batiste.dosimple.ch/blog/2007-05-13-1/

new forms have changed this binding and made things easy so you can
also check
http://www.djangoproject.com/documentation/newforms/#binding-uploaded-files-to-a-form


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: FileInput widget and FileField

2007-09-10 Thread Dushyant Sharma

here is model
class Thing(models.Model):
PID=models.ForeignKey(Property)
name = models.CharField(blank=False, null=False, maxlength=30)
photo = models.ImageField(upload_to='images/things/', blank=True,
null=True)
the form
class ThingForm(forms.Form):
name = forms.CharField(max_length=30, required=True, label=_('Name
of the thing'))
photo = forms.Field(widget=forms.FileInput, required=False,
label=_('Photo'))

html



save data
new_data = request.POST.copy()  # these two lines
are
new_data.update(request.FILES)   # very important
form = ThingForm(new_data)
if form.is_valid():
clean_data = form.clean_data
t = Thing()
t.name = clean_data['name']
if clean_data['photo']:
photo = clean_data['photo']
t.save_photo_file(photo['filename'],
photo['content'])

you can also eliminate model and save directly to some binary stream


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: php fsockopen equivalent in Django

2007-09-10 Thread Dushyant Sharma

may be you can use ajax for that. i have tried and it works wonders.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



log in without loggin in

2007-09-04 Thread Dushyant Sharma

hi it might sound strange but what i am thinking is to use two servers
one for authentication only and one for serving normal content.
authentication server can not come into direct contact with users.
here how it goes.

suppose we have user server USrv and authentication server ASrv.
auth_user table is at ASrv only.
request for log in from the user goes to USrv. Usrv sends it to ASrv
for authentication. If ASrv says the user is authentic then USrv treat
the user as logged in without actually calling authenticate() function
for it.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Email problem

2007-06-14 Thread Dushyant Sharma

i think you should try port 25 at EMAIL_PORT after all you wont loss
anything giving a try

On Jun 14, 6:12 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Thu, 2007-06-14 at 05:35 -0700, Brij wrote:
> > Hi,
>
> > I am using the django.core.mail for sending mail to users in my
> > application...I have defined EMAIL_HOST but havenot defined EMAIL_PORT
> > because my smtp server doesnt require a port number...
>
> All services require a port number. If you don't specify the EMAIL_PORT,
> it will use the default (and standard value) of 25. That's fine; just
> making you aware that it is using a port number even if you don't
> specify it.
>
> > Following is the view function im using :::
>
> > def send_email(request, sender, reciepient):
> > subject = 'Test Mail from OST'
> > message = 'Testing email from OST'
> > from_email = '[EMAIL PROTECTED]'
> > if subject and message and from_email:
> >try:
> >send_mail(subject, message, from_email,
> > ['[EMAIL PROTECTED]'])
>
> [...]
>
> > The error which i m getting is :::
> > Exception Value: (10054, 'Connection reset by peer')
> > Exception Location: C:\Python24\Lib\socket.py in readline, line 340
>
> There's no way I can think of to tell what the problem is from this
> information. All the error message is saying is that you made a
> connection to a server (so something is listening on port 25 on the
> machine you specified) and then it hung up on you at some later point.
>
> Debugging network transactions like this is difficult. Ideally, use a
> network sniffer to see the traffic going back and forth between the
> client and the server so that you can tell where the problem occurs
> (since an email sending interaction is a series of requests and
> responses, there are a number of places it can go wrong). If you have
> access to the mail logs on the server, that is another way to determine
> what is going wrong (not normally posssible in many environments,
> though, so it's unlikely you'll be able to use this route).
>
> Check to see if you SMTP server requires using a TLS connection, rather
> than just a plain connection (if so, use the TLS parameter from the
> latest Django code -- this option won't be available in the 0.96
> release, however).
>
> There's not really much I can think to suggest short of finding a way to
> watch the network traffic (with something like WireShark), since you
> need to know what went wrong and when. At the moment, all you know is
> that "it didn't work", which could mean any one of a hundred things.
>
> Some other respondents may have other ideas, though.
>
> Regards,
> Malcolm


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: jsonrpc working example

2007-06-14 Thread Dushyant Sharma

here is what i am doing
server code

from jsonrpc import handleCGI, ServiceMethod
from django.core import serializers
@ServiceMethod
def hello(msg):
json = serializers.serialize("json",msg)# initially i tried
return(msg)only but i was getting error JSONDecodeException at /c/
testhello/
 
#Expected []{}," or Number, Null, False or True
return HttpResponse(json)
or
   return (json)

or i can use
return HttpResponse(json,mimetype='application/javascript')

none of them works

at client side i use
def testhello(response):
s = ServiceProxy("http://localhost/s/hello";)
resp=s.hello('hello')# this is where i am doubtful
return HttpResponse(resp)

when calling it shows error
JSONDecodeException at /c/testhello/
Expected []{}," or Number, Null, False or True

what i am trying is creating two projects setup with apache virtual
host. one is interacting with user as we do normally. another is
serving the first project by taking requests and sending response to
the first without letting the user know anything.

On Jun 14, 5:39 pm, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote:
> On 14-Jun-07, at 6:00 PM, Dushyant Sharma wrote:
>
> > has any body used jsonrpc with django if yes kindly help me
> > here is how to use it but i cant use it with django facing problems
>
> would be helpful if you stated what you tried and what the errors were
>
> --
>
> regards
> kghttp://lawgon.livejournal.comhttp://nrcfosshelpline.in/web/


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



jsonrpc working example

2007-06-14 Thread Dushyant Sharma

has any body used jsonrpc with django if yes kindly help me
here is how to use it but i cant use it with django facing problems
http://json-rpc.org/wiki/python-json-rpc


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: session variable in template

2007-06-13 Thread Dushyant Sharma

how can i use it with HttpResponseRedirect()

like if i wish to use it as return HttpResponseRedirect('/someurl',
RequestContext(request))

is it possible

On Jun 13, 5:42 am, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Tue, 2007-06-12 at 13:27 +0000, Dushyant Sharma wrote:
> > i am building single page for logged in users and anonymous users
> > where i can use uid for logged in users and show specific things to
> > them and for this i want to use session variable in template. i am
> > trying request.session.uid in template where uid is session
> > variable..
>
> Have a read 
> ofhttp://www.djangoproject.com/documentation/authentication/#authentica 
> That should explain what you need.
>
> Regards,
> Malcolm


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



session variable in template

2007-06-12 Thread Dushyant Sharma

i am building single page for logged in users and anonymous users
where i can use uid for logged in users and show specific things to
them and for this i want to use session variable in template. i am
trying request.session.uid in template where uid is session
variable..

i have set request.session['uid']=str(user.id)

now i want to dothe following  in template
{% if request.session.id %}
  you are logged in
{% endif %}
but nothing is showing

 here i am loggin user in
login(request, user)
request.session['uname']=username
uu=User.objects.get(username=username)
request.session['uid']=str(uu.id)


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: manipulator for auth.user

2007-06-08 Thread Dushyant Sharma

come on somebody pl. reply


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: manipulator for auth.user

2007-06-08 Thread Dushyant Sharma

if this is possible or not to apply manipulator on User and on two
models.
i have read previous posts in this regard sugggesting method what i
have used but i am getting errors as above.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



manipulator for auth.user

2007-06-08 Thread Dushyant Sharma

i am trying to add manipulator on default User object. i am getting
name, email and address from the form and trying to fill  date_joined
and last_login attributes myself as

user_data['date_joined_date']=datetime.date.today()
user_data['date_joined_time']=(datetime.time()
user_data['last_login_date']=datetime.date.today()
user_data['last_login_time']=datetime.time()
uerrors=umanipulator.get_validation_errors(user_data)
 it shows
Exception Value:'datetime.date' object has no attribute 'decode'

if i convert all of them to string with strftime() as

user_data['date_joined_date']=datetime.datetime.now().strftime('%Y-%m-
%d')
user_data['date_joined_time']=datetime.datetime.now().strftime('%H:%M:
%S')
user_data['last_login_date']=datetime.datetime.now().strftime('%Y-%m-
%d')
user_data['last_login_time']=datetime.datetime.now().strftime('%H:%M:
%S')
 it says

Exception Value:  combine() argument 1 must be datetime.date, not str

what actually i am doing is i am trying to add manipulator on two
objects with
umanipulator = User.AddManipulator()
manipulator = Builder.AddManipulator()
user_data['date_joined_date']=datetime.date.today()
user_data['date_joined_time']=(datetime.time()
user_data['last_login_date']=datetime.date.today()
user_data['last_login_time']=datetime.time()
uerrors=umanipulator.get_validation_errors(user_data)
if not (uerrors):
new_user = umanipulator.save(user_data)
u=User.object.get(username__exact=user_data['id_username'])
and with u.id i ll save other object with same method


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: if 'photo' in request.FILES seems to be not working

2007-06-06 Thread Dushyant Sharma

i can not beleive this i had only to write enctype in capital
ENCTYPE="multipart/form-data"
i am sick


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django Deployment Headache (Apache Permissions?)

2007-06-06 Thread Dushyant Sharma

i am having the same problem i tried  adding mysite.pth to site-
packages folder
now i can see the path in python as
/root/workspace/
and
/root/workspace/mysite

settings.py is in  mysite directory at /root/workspace also i have
__init_.py there
it show the same error
but if i put the directory mysite at site-packages it works just fine




--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



if 'photo' in request.FILES seems to be not working

2007-06-06 Thread Dushyant Sharma

hi friends
i am trying to upload an image file but i am getting errors.
code is as follows

def thing_add(request):
if request.method == 'POST':
if 'photo' in request.FILES:
# it aint getting here just skip this section
try:
img = Image.open(StringIO(request.FILES['photo']
['content']))
request.FILES['photo']['dimensions'] = img.size
except:
request.FILES['photo']['error'] = True

new_data = request.POST.copy()
new_data.update(request.FILES)

form = ThingForm(new_data)
if form.is_valid():
clean_data = form.clean_data
t = Thing()
t.name = clean_data['name']
if clean_data['photo']:
photo = clean_data['photo']
t.save_photo_file(photo['filename'], photo['content'])

return HttpResponse('/some/where')
else:
form = ThingForm()

context = Context({'form': form})
return render_to_response('loadfiles.html', context)


with loadfiles having



i am having an exception
Exception Value:string indices must be integers
at line
 t.save_photo_file(photo['filename'], photo['content'])


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: access user.id

2007-05-30 Thread Dushyant Sharma

hey thanks chrominance for real good helping stuff.
i was not looking at the last line which clearly states that

argument 1 must be string or read-only buffer, not long

your return HttpResponse(str(uu.id))is really helpful
and also thanks for get() and filter().  i'll keep that in mind


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---