os.path

2010-08-01 Thread yalda.nasirian
hi

note

 If you want to be a bit more flexible and decoupled, though, you can
take advantage of the fact that Django settings files are just Python
code by constructing the contents of TEMPLATE_DIRS dynamically, for
example:

import os.path

TEMPLATE_DIRS = (
os.path.join(os.path.dirname(__file__), 'templates').replace('\
\','/'),
)

where is my is.path ? how can i get it ?

tanx friends

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



Re: Django 1.3

2010-08-01 Thread Russell Keith-Magee
On Sun, Aug 1, 2010 at 10:35 PM, mayikmaster  wrote:
> hello and thank you for this great project which I have learned so
> much. I would like to know what will happen with djanggo 1.3 Where
> we've heard.many thanks

Formal plans for Django 1.3 have not yet been announced.

However, as a rough indication, I would expect to see a 1.3 release at
very end of this year (perhaps early next year if schedules run over).
There won't be a lot of major new features delivered in Django 1.3;
the focus will be on fixing bugs and adding minor features that were
missed during the 1.2 development cycle.

Yours
Russ Magee %-)

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



where is my os.path

2010-08-01 Thread yalda.nasirian
hi
when i type import sys or os i have error that unknown os

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



Does anyone know how to conditionally set the fieldsets??

2010-08-01 Thread gondor
I use fieldsets in my admin panel to group/title my related fields.
This works great in superuser.  When I log in as staff, which has some
fields excluded I get an error.

Caught KeyError while rendering: Key 'A' not found in Form

In the simple example below if i'm a super user all works great.
If i log in as a staff user thus the code exclude A fieldset I get the
the error:

models.py:

class Cars(models.Model):
  A = models.CharField('A', ...)
  B = models
  C = models...
  D = models...

admin.py:

class CarsAdmin(admin.ModelAdmin):
  fieldsets = (_('first group'},{'fields'sad('A','B'),('C','D'),)})
  def get_form(self,request,obj=None, **kwargs):
self.exclude = []
if not request.user.is_superuser:
   self.exclude.append('A')
return super(CarAdmin,self).get_form(request, obj=None, **kwargs)

Bottom line is I want to maintain the grouping offered by fieldsets.

Does anyone know how to conditionally set the fieldsets??

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



Re: ModelChoiceField Question

2010-08-01 Thread Steve Holden
On 7/29/2010 8:56 AM, Daniel Roseman wrote:
> On Jul 29, 5:23 am, Carlos Daniel Ruvalcaba Valenzuela
>  wrote:
>> Hello list,
>>
>> I was wondering which would be the best way to handle this situation
>> with ModelChoiceFields:
>>
>> I have a form with a ModelChoiceField, the options presented in this
>> field may change at the view depending on the user, however,
>> ModelChoiceField requires the queryset to be given as a parameter when
>> defining the form, which is the best way to handle this? is there a
>> commonly used way for this? I was thinking on using a Factory method
>> like this:
>>
>> def MyForm_builder(queryset):
>> class MyForm(forms.Form):
>> field = forms.ModelChoiceField(queryset=queryset)
>> return MyForm
>>
>> Any thoughts on this?
>>
>> Regards,
>> Carlos Daniel Ruvalcaba Valenzuela
> 
> You can easily override the __init__ method to change the queryset on
> form instantiation, by passing in an extra `user` keyword arg:
> 
> def MyForm(forms.Form):
> field =
> forms.ModelChoiceField(queryset=MyModel.objects.none())
> 
> def __init__(self, *args, **kwargs):
> user = kwargs.pop('user', None)
> super(MyForm, self).__init__(*args, **kwargs)
> self.fields['field'].queryset =
> MyModel.objects.filter(user=user)
> 
You can, but shouldn't you be calling the suplerclass's __init__() as
well do make sure any necessary initialization gets performed?

Of course there is no reason (except efficiency) that says the form has
to be constructed once, and no reason why it can't be created
dynamically depending on the user when the required view is called.

regards
 Steve

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



Re: Which program will run when we execute "djano-admin.py startproject mysite" command?

2010-08-01 Thread Jirka Vejrazka
Hi Balu,

   django-admin.py uis copied to C:\Python2x\Scripts on your PC
(depending on the specific Python version). This is not typically on
you system path, so Windows can't find it.

  A simple solution is to copy or move the django-admin.py from
Scripts subdir to C:\Python2x (where python.exe resides.

  Cheers

 Jirka


On 01/08/2010, balu  wrote:
> Thank you. I could able to run python programs well using the Python
> GUI. It is the problem raised when I tried to execute "django-admin.py
> startproject mysite" command on Windows 7
>
> On Aug 1, 9:26 pm, Karen Tracey  wrote:
>> On Sun, Aug 1, 2010 at 11:47 AM, balu  wrote:
>> > Still I couldn't made it on window 7. May be it is incompatible with
>> > Django
>>
>> I don't have Windows 7 to test, but the problem you are describing
>> (Windows
>> not knowing what executable is associated with .py files) is not a
>> Django-specific problem: it would affect any Python application.
>>
>> You might have better luck if you search generally on getting the python
>> executable properly associated with the .py file extension on Windows 7.
>>
>> The alternative way of running the command, that is including "python" at
>> the front of the command, requires that the path to the python.exe file be
>> included in your windows PATH. So if you cannot find out how to get the
>> .py
>> file association set up properly, you could instead figure out where
>> python.exe is add that directory to your PATH.
>>
>> Karen
>> --http://tracey.org/kmt/
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: Django error can't adapt

2010-08-01 Thread Daniel França
Hi, I'm not running on Apache, just trying to run in the django
standalone server

On Sun, Aug 1, 2010 at 5:47 AM, Antoni Aloy  wrote:
> 2010/8/1 Daniel França :
>> Hi,
>> I just migrated from Linux to Mac OS, and I'm getting an error message
>> when I try register a new user of my django site, (at my page)
>> I get the error: can't adapt type 'US/Eastern'
>> I'm using Postgresql and psycopg2, I tried to change the TIME_ZONE to
>> 'America/Sao_Paulo'(I'm in Brazil), but the error still happens.
>>
>> I tried anothers possibilities of TIME_ZONE but no success.
>>
>> Anyone know how to solve that?
>>
>> Best Regards,
>> Daniel França
>>
> Do you have more than one django instance on mod_python? If this is
> the case it's a bug with mod_python and Postgres. Change to wsgi and
> the problem would dissapear.
>
> Hope it helps!
>
>
> --
> Antoni Aloy López
> Blog: http://trespams.com
> Site: http://apsl.net
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: Django 1.3

2010-08-01 Thread Alexander Jeliuc
It is django-users group. Isn't it?

On Sun, Aug 1, 2010 at 5:35 PM, mayikmaster  wrote:

> hello and thank you for this great project which I have learned so
> much. I would like to know what will happen with djanggo 1.3 Where
> we've heard.many thanks
>
>
> ---
>  hola y gracias por este gran proyecto del cual he aprendido tanto. me
> gustaria saber que va pasar con djanggo 1.3 cuando tendremos noticias
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: Which program will run when we execute "djano-admin.py startproject mysite" command?

2010-08-01 Thread balu
Thank you. I could able to run python programs well using the Python
GUI. It is the problem raised when I tried to execute "django-admin.py
startproject mysite" command on Windows 7

On Aug 1, 9:26 pm, Karen Tracey  wrote:
> On Sun, Aug 1, 2010 at 11:47 AM, balu  wrote:
> > Still I couldn't made it on window 7. May be it is incompatible with
> > Django
>
> I don't have Windows 7 to test, but the problem you are describing (Windows
> not knowing what executable is associated with .py files) is not a
> Django-specific problem: it would affect any Python application.
>
> You might have better luck if you search generally on getting the python
> executable properly associated with the .py file extension on Windows 7.
>
> The alternative way of running the command, that is including "python" at
> the front of the command, requires that the path to the python.exe file be
> included in your windows PATH. So if you cannot find out how to get the .py
> file association set up properly, you could instead figure out where
> python.exe is add that directory to your PATH.
>
> Karen
> --http://tracey.org/kmt/

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



Re: Which program will run when we execute "djano-admin.py startproject mysite" command?

2010-08-01 Thread balu
I could able to run python programs using the Python GUI. I could say
that the problem raised because of functionality of Python it is
because of Django.

On Aug 1, 9:26 pm, Karen Tracey  wrote:
> On Sun, Aug 1, 2010 at 11:47 AM, balu  wrote:
> > Still I couldn't made it on window 7. May be it is incompatible with
> > Django
>
> I don't have Windows 7 to test, but the problem you are describing (Windows
> not knowing what executable is associated with .py files) is not a
> Django-specific problem: it would affect any Python application.
>
> You might have better luck if you search generally on getting the python
> executable properly associated with the .py file extension on Windows 7.
>
> The alternative way of running the command, that is including "python" at
> the front of the command, requires that the path to the python.exe file be
> included in your windows PATH. So if you cannot find out how to get the .py
> file association set up properly, you could instead figure out where
> python.exe is add that directory to your PATH.
>
> Karen
> --http://tracey.org/kmt/

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



Re: Which program will run when we execute "djano-admin.py startproject mysite" command?

2010-08-01 Thread Karen Tracey
On Sun, Aug 1, 2010 at 11:47 AM, balu  wrote:

> Still I couldn't made it on window 7. May be it is incompatible with
> Django
>

I don't have Windows 7 to test, but the problem you are describing (Windows
not knowing what executable is associated with .py files) is not a
Django-specific problem: it would affect any Python application.

You might have better luck if you search generally on getting the python
executable properly associated with the .py file extension on Windows 7.

The alternative way of running the command, that is including "python" at
the front of the command, requires that the path to the python.exe file be
included in your windows PATH. So if you cannot find out how to get the .py
file association set up properly, you could instead figure out where
python.exe is add that directory to your PATH.

Karen
-- 
http://tracey.org/kmt/

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



Re: Crashing Dev Server (or Browser?)

2010-08-01 Thread Kev
rmschne wrote:

> Sorted.  But gosh, why did this simple error crash Python?
>
> for both these models, a recent change was to remove a database field
> and replace with function in the model.  However I neglected to change
> the __unicode__() method for that model to change the the variable
> from "self.abcdefg" to "self.abcdefg()".  Doing that for both fixed
> the crashing problem.
>
> I've never been able to crash Python before.  Exception handling
> always seemed to work. I feel rather proud.  (but wonder how this
> possible).
>

>From the looks of the crash dump, it looks as if Python is trying to
compute some kind of illegal time value, but I on't have a Mac so I'm
afraid I'm guessing.  Glad you around it,

Kev

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



Re: Is there anyone who is using Django on Windows 7 host system.

2010-08-01 Thread Michael Hipp
I'm using it on two Win7 systems (one x32, one x64). The 
"django-admin.py startproject mysite" command seems to do just what is 
expected. But note that I can't just enter it that way. Here's what I do:


python C:\dev\virtenvs\redmule\Scripts\django-admin.py startproject mysite

This is because I use a virtual environment to hold the django packages.

If you're not using a virtual environment that command might be:

python c:\python26\Scripts\django-admin.py startproject mysite

This needs to be entered from the dir where you want the 'mysite' dir to 
be created.


There are 4 things to be aware of:
- Where is python installed?
- Where did the django-admin.py scipt get installed (determined by how 
Django was installed or not)?

- What is the PYTHONPATH?
- What is the system PATH (is python in that path, is django-admin.py in 
it)?


What, precisely, are the symptoms of the problem you're having?

Michael


On 8/1/2010 10:49 AM, balu wrote:

I'm not getting the actual result which should we get when we run
"django-admin.py startproject mysite" on  windows 7 Operating system.



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



django using apache2 and mod_wsgi

2010-08-01 Thread watad
dear all

i am using django with apache2 and mod_wsgi with djapian as my search
engine
i have noticed two major issues so far :

1) the first issue is when i use djapian im stuck in a deadlock when i
call any Xapian method or function (this is explained in this ticket
http://trac.xapian.org/ticket/185)
i used the solution posted there for mod_wsgi
i added WSGIApplicationGroup %{GLOBAL} then djapian search started to
work again
but i noticed that my sites css and contents was corrupted and the
content of my sites was mixed, i removed WSGIApplicationGroup %
{GLOBAL}  and the sites was rendering normally again.(of course I am
restarting apache continually)

2) i am also getting problems with different browsers , meaning when i
use firefox, sites render normally but with ie 7 or 8 they are not
rendering properly , i thought at the beginning it is css browsers
compatibility issue but when i run my sites using django development
server (using runserver command)i get my sites working fine for both
ie and firefox

has anyone faced similar issues

please help , any suggestion is 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-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



django using apache2 and mod_wsgi

2010-08-01 Thread watad
dear all

i am using django with apache2 and mod_wsgi with djapian as my search
engine
i have noticed two major issues so far :

1) the first issue is when i use djapian im stuck in a deadlock when i
call any Xapian method or function (this is explained in this ticket
http://trac.xapian.org/ticket/185)
i used the solution posted there for mod_wsgi
i added WSGIApplicationGroup %{GLOBAL} then djapian search started to
work again
but i noticed that my sites css and contents was corrupted and the
content of my sites was mixed, i removed WSGIApplicationGroup %
{GLOBAL}  and the sites was rendering normally again.(of course I am
restarting apache continually)

2) i am also getting problems with different browsers , meaning when i
use firefox, sites render normally but with ie 7 or 8 they are not
rendering properly , i thought at the beginning it is css browsers
compatibility issue but when i run my sites using django development
server (using runserver command)i get my sites working fine for both
ie and firefox

has anyone faced similar issues

please help , any suggestion is 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-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Is there anyone who is using Django on Windows 7 host system.

2010-08-01 Thread balu
I'm not getting the actual result which should we get when we run
"django-admin.py startproject mysite" on  windows 7 Operating system.

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



Re: To access specific columns in a table?

2010-08-01 Thread Kaushik Vemula
Yeah, that will do. You made me a point to read documentation more
carefully.

Thank you !



On Aug 1, 10:22 am, Franklin Einspruch 
wrote:
> Will this do?
>
> http://docs.djangoproject.com/en/dev/ref/models/querysets/#only-fields
>
> Franklin
>
> On Sun, Aug 1, 2010 at 11:14 AM, Kaushik Vemula
>
>  wrote:
> > Hi,
> > when I use objects.all(), I get all the columns in a table. How to
> > limit it to some specific columns of the table?
>
> > Thank you.
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "Django users" group.
> > To post to this group, send email to django-us...@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://groups.google.com/group/django-users?hl=en.
>
> --
> Art, writing, journal:http://einspruch.com
> Comics:http://themoonfellonme.com

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



Re: Which program will run when we execute "djano-admin.py startproject mysite" command?

2010-08-01 Thread balu
Still I couldn't made it on window 7. May be it is incompatible with
Django.



On Aug 1, 1:09 am, "Casey S. Greene"  wrote:
> It runs django-admin.py using the python interpreter.
>
> Maybe this webpage, or a windows user on this list, will have the 
> answer:http://docs.python.org/faq/windows.html
>
> Hope this helps,
> -- Casey
>
> On 07/31/2010 03:57 PM, balu wrote:
>
> > Yah... I tried it by adding python in the command line. But I couldn't
> > get the actual result. Could you people can give a gist of what
> > happens when we type "django-admin.py startproject mysite" i.e., which
> > program will run when we type that and press return key.
>
> > On Aug 1, 12:41 am, "Casey S. Greene"  wrote:
> >> Hi,
>
> >> I'm not a windows user but I'm guessing that you want to use the python
> >> executable (see if you can find something called "python".
> >> Alternatively, what if you run it with:
>
> >> python django-admin.py startproject mysite
>
> >> Hope this helps,
> >> -- Casey
>
> >> On 07/31/2010 03:12 PM, balu wrote:
>
> >>> Hi everybody
>
> >>> I installed python and django in my Windows 7 home premium operating
> >>> system. But when I tried to execute "django-admin.py startproject
> >>> mysite" command in it, the Operating system is asking me to choose the
> >>> program to run this application. But this is not happened when I tried
> >>> this in Windows XP.
>
> >>> Please guide me to solve this. Is Windows 7 is incompatible with this
> >>> command ??
>
> >>> Looking forward for answer
>
> >>> thank you

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



Re: To access specific columns in a table?

2010-08-01 Thread Franklin Einspruch
Will this do?

http://docs.djangoproject.com/en/dev/ref/models/querysets/#only-fields

Franklin


On Sun, Aug 1, 2010 at 11:14 AM, Kaushik Vemula
 wrote:
> Hi,
> when I use objects.all(), I get all the columns in a table. How to
> limit it to some specific columns of the table?
>
> Thank you.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>



-- 
Art, writing, journal: http://einspruch.com
Comics: http://themoonfellonme.com

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



To access specific columns in a table?

2010-08-01 Thread Kaushik Vemula
Hi,
when I use objects.all(), I get all the columns in a table. How to
limit it to some specific columns of the table?

Thank you.

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



To access specific columns in a table?

2010-08-01 Thread Kaushik Vemula
Hi,
when I use objects.all(), I get all the columns in a table. How to
limit it to some specific columns of the table?

Thank you.

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



Re: Crashing Dev Server (or Browser?)

2010-08-01 Thread rmschne
Sorted.  But gosh, why did this simple error crash Python?

for both these models, a recent change was to remove a database field
and replace with function in the model.  However I neglected to change
the __unicode__() method for that model to change the the variable
from "self.abcdefg" to "self.abcdefg()".  Doing that for both fixed
the crashing problem.

I've never been able to crash Python before.  Exception handling
always seemed to work. I feel rather proud.  (but wonder how this
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-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Django 1.3

2010-08-01 Thread mayikmaster
hello and thank you for this great project which I have learned so
much. I would like to know what will happen with djanggo 1.3 Where
we've heard.many thanks


---
 hola y gracias por este gran proyecto del cual he aprendido tanto. me
gustaria saber que va pasar con djanggo 1.3 cuando tendremos noticias


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



Re: 'python manage.py startproject survey' does not add 'survey' to INSTALLED _APPS.

2010-08-01 Thread Karen Tracey
On Thu, Jul 29, 2010 at 5:25 PM, to_see  wrote:

> Huh.  I missed that one, I was working from a book I bought, which did
> not explain that I needed to do that, as far as I can tell (but maybe
> I am a bit careless?).  I will try to be more careful!
>

It is there, perhaps it is not listed as explicitly as it needs to be. It is
in the paragraph about adjusting the database settings on page 13, the one
that starts "In order to run the sample tests.py file...": "Now would also
be a good time to add our survey application and django.contrib.admin to
INSTALLED_APPS..."

Karen
-- 
http://tracey.org/kmt/

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



Re: How to access a MySQL table in Django?

2010-08-01 Thread Karen Tracey
On Thu, Jul 29, 2010 at 11:39 AM, snipinben  wrote:

>
> yeah, i was able to find that exact thing yesterday, and it works and i am
> so
> happy.  now i have one more problem, i cnat get oracle-cx to work. it says
> that "no software installation was found" or something like that. i have
> the
> python-mysql working but i cant seem to get the oracle database connector
> to
> work. got anny suggestions? im running a linux platform with Ubuntu.
>
>
I'd recommend starting a new thread for this question, since I'm not sure
Oracle experts on this list will notice a question about Oracle buried in a
thread that has MySQL in the subject. Also it would help people help you if
you were very specific about what you have done to install the Oracle
driver, what exactly triggers the error, and the exact error message instead
of "something like" it.

Karen
-- 
http://tracey.org/kmt/

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



Re: JSON reponseText is undefined

2010-08-01 Thread Himanshu Srivastava
Hi
sorry for the mistake
Actualy i found that the code is not working even if i send a string
the actual code  is as follows

Views.py


return HttpResponse('Hello')

Javascript

var ajaxRequest;
  try{
// Opera 8.0+, Firefox, Safari
ajaxRequest = new XMLHttpRequest();
 } catch (e){
   // Internet Explorer Browsers
  try{
ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
 } catch (e) {
  try{
ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
 } catch (e){
// Something went wrong
 alert("Your browser broke!");
 return false;
}
}
}
alert("Here");
 ajaxRequest.onreadystatechange = function(data){
 alert("ajax");
 if(ajaxRequest.readyState == 4){
 alert(data.responseText);
}
 alert("out");
var infoToSend = encodeURI("?
state_id="+id+"&company_id="+document.getElementById('Hidden_Capital1'));
 ajaxRequest.open("GET", "http://localhost:8000/Software/update_state/";, true);
 ajaxRequest.setRequestHeader("Content-type",
"application/x-www-form-urlencoded");
 ajaxRequest.setRequestHeader("Content-length", infoToSend.length);
 ajaxRequest.setRequestHeader("Connection", "close");
 ajaxRequest.send(infoToSend);

On Sun, Aug 1, 2010 at 5:03 PM, Daniel Roseman  wrote:
> On Aug 1, 8:54 am, Himanshu Srivastava 
> wrote:
>> Hi
>> I am sending  a Json data from django on an ajax call as A
>> HttpResponse but i get it as undefined when i try to access it in
>> javascript
>> The code is as follows\
>>
>> Views.py
>>
>> data=simplejson.dump(dic)
>> return HttpResponse(data,mimetype='application/json')
>>
>> Javascript
>>
>> var ajaxRequest;
>>    try{
>>          // Opera 8.0+, Firefox, Safari
>>          ajaxRequest = new XMLHttpRequest();
>>       } catch (e){
>>         // Internet Explorer Browsers
>>    try{
>>          ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
>>       } catch (e) {
>>    try{
>>          ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
>>       } catch (e){
>> // Something went wrong
>>           alert("Your browser broke!");
>>           return false;
>>          }
>>      }
>>      }
>> alert("Here");
>>  ajaxRequest.onreadystatechange = function(data){
>>  alert("ajax");
>>  if(ajaxRequest.readyState == 4){
>>       document.getElementById('State_Over').innerHTML=res.state_name;
>>       document.getElementById('Farming_Rate').innerHTML=res.Farming_Rate;
>>
>>      }
>>  alert("out");
>> var infoToSend = encodeURI("?
>> state_id="+id+"&company_id="+document.getElementById('Hidden_Capital1'));
>>  ajaxRequest.open("GET", "http://localhost:8000/Software/update_state/";, 
>> true);
>>  ajaxRequest.setRequestHeader("Content-type",
>> "application/x-www-form-urlencoded");
>>  ajaxRequest.setRequestHeader("Content-length", infoToSend.length);
>>  ajaxRequest.setRequestHeader("Connection", "close");
>>  ajaxRequest.send(infoToSend);
>>
>> PLEASE HELP SOON...
>> BYE
>
> Well, this obviously isn't the code that gives that error, as you
> haven't used `responseText` anywhere. You have used `res`, without
> defining it, in your onreadystatechange handler.
> --
> DR.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: Get request path without having a request object

2010-08-01 Thread cootetom
I have found some code that can get the request object.

f = sys._getframe()
while f:
request = f.f_locals.get('request')
if isinstance(request, HttpRequest):
path = request.path
break
f = f.f_back


James: I understand completely what you are saying and have thought
long and hard about how I can achieve what I'm doing without needing
the above code. I am creating an app that will provide a UI to admins
to translate the text on each web page. The app needs to keep a track
of which text from the current active language locale files has been
used in the rendering of the current page they're on. At the same time
I didn't want to have to change the way in which developers mark text
for translation. This meant that I needed to override the gettext and
template translation tags with custom ones which first remembered what
message ID's were being used and second just called the default Django
versions of these methods. However neither gettext or the template
translation tags need to be aware of the request but to remember which
message ID's are in use for a page I needed to know about the request.
My options were either change my overriding methods to also accept a
request object or find the object via another means. The latter seemed
easier on future development.

My app is almost finished. I need to do a load of testing on it. I'm
then going to place it into an existing site that uses locale files
for it's text. After that, I plan to release it for download so that
others can use it. It turns out really useful to have a UI that will
manage locale text. I have looked at another one called rosetta but it
was implemented into the admin system and so didn't have a way of
showing which text was used on specific pages which I think is really
useful, especially if clients want to get involved with text
translation.




On Aug 1, 4:23 am, James Bennett  wrote:
> On Sat, Jul 31, 2010 at 12:37 PM, cootetom  wrote:
> > Thanks Carlos but I'm trying to achieve getting the path without
> > having to pass the request object.
>
> In a word: don't.
>
> Instead, design your system to pass the information you need where and
> when you need it. This doesn't mean everything always has to sling
> around a request object, just that you need to think carefully about
> separation of concerns and which code needs to get at the request.
>
> Do this, and in 6-12 months when you have to start making changes to
> update your application, you'll be incredibly thankful that you did it
> right the first time around.
>
> --
> "Bureaucrat Conrad, you are technically correct -- the best kind of correct."

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



Re: JSON reponseText is undefined

2010-08-01 Thread Daniel Roseman
On Aug 1, 8:54 am, Himanshu Srivastava 
wrote:
> Hi
> I am sending  a Json data from django on an ajax call as A
> HttpResponse but i get it as undefined when i try to access it in
> javascript
> The code is as follows\
>
> Views.py
>
> data=simplejson.dump(dic)
> return HttpResponse(data,mimetype='application/json')
>
> Javascript
>
> var ajaxRequest;
>    try{
>          // Opera 8.0+, Firefox, Safari
>          ajaxRequest = new XMLHttpRequest();
>       } catch (e){
>         // Internet Explorer Browsers
>    try{
>          ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
>       } catch (e) {
>    try{
>          ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
>       } catch (e){
> // Something went wrong
>           alert("Your browser broke!");
>           return false;
>          }
>      }
>      }
> alert("Here");
>  ajaxRequest.onreadystatechange = function(data){
>  alert("ajax");
>  if(ajaxRequest.readyState == 4){
>       document.getElementById('State_Over').innerHTML=res.state_name;
>       document.getElementById('Farming_Rate').innerHTML=res.Farming_Rate;
>
>      }
>  alert("out");
> var infoToSend = encodeURI("?
> state_id="+id+"&company_id="+document.getElementById('Hidden_Capital1'));
>  ajaxRequest.open("GET", "http://localhost:8000/Software/update_state/";, 
> true);
>  ajaxRequest.setRequestHeader("Content-type",
> "application/x-www-form-urlencoded");
>  ajaxRequest.setRequestHeader("Content-length", infoToSend.length);
>  ajaxRequest.setRequestHeader("Connection", "close");
>  ajaxRequest.send(infoToSend);
>
> PLEASE HELP SOON...
> BYE

Well, this obviously isn't the code that gives that error, as you
haven't used `responseText` anywhere. You have used `res`, without
defining it, in your onreadystatechange handler.
--
DR.

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



Re: django-admin.py not working

2010-08-01 Thread Daniel Roseman
On Jul 31, 3:41 pm, ginost7  wrote:
> Im using ubuntu
>
> I managed to get through the poll project working on the django tut.
>  then tried another project
>
> At the prompt i get
>
> g...@gino-laptop:~/djangoDEV$ django-admin
> The program 'django-admin' is currently not installed.  You can
> install it by typing:
> sudo apt-get install python-django
>
> what is the matter?
>
>  I verified  that django is installed:
>
> g...@gino-laptop:~/djangoDEV$ python
> Python 2.6.4 (r264:75706, Dec  7 2009, 18:45:15)
> [GCC 4.4.1] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>
>
>
> >>> import django


django-admin.py is not on your path. Either copy it into a directory
that is (eg /usr/local/bin, or ~/bin if you have one) or add its
current directory to the PATH.
--
DR.

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



Re: Crashing Dev Server (or Browser?)

2010-08-01 Thread rmschne
Kev,

Thanks.  A bit more info:  The "add" button works, but the "change"
and the link to the table name crashes.   Happens in both Chrome and
Safari ... so doubt the browser.

The server:
[01/Aug/2010 12:02:26] "GET /admin/soc_util/annualdinnerhost/ HTTP/
1.1" 200 26977
[01/Aug/2010 12:02:26] "GET /admin/jsi18n/ HTTP/1.1" 200 1761
then system prompt.

Process: Python [2475]
Path:/System/Library/Frameworks/Python.framework/Versions/
2.6/Resources/Python.app/Contents/MacOS/Python
Identifier:  Python
Version: ??? (???)
Code Type:   X86-64 (Native)
Parent Process:  Python [2470]

Date/Time:   2010-08-01 12:02:29.241 +0100
OS Version:  Mac OS X 10.6.4 (10F569)
Report Version:  6

Interval Since Last Report:  613176 sec
Crashes Since Last Report:   18
Per-App Crashes Since Last Report:   12
Anonymous UUID:  0C848737-E8F3-4A6B-
A6EB-0C15BDF0E967

Exception Type:  EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x000101c00d50
Crashed Thread:  1

Thread 0:  Dispatch queue: com.apple.main-thread
0   libSystem.B.dylib   0x7fff81e97dce select
$DARWIN_EXTSN + 10
1   time.so 0x0001007e6fc4
_PyTime_DoubleToTimet + 1503
2   org.python.python   0x000100089187
PyEval_EvalFrameEx + 15317
3   org.python.python   0x0001000892e1
PyEval_EvalFrameEx + 15663
4   org.python.python   0x0001000892e1
PyEval_EvalFrameEx + 15663
5   org.python.python   0x00010008acce
PyEval_EvalCodeEx + 1803
6   org.python.python   0x00010008935e
PyEval_EvalFrameEx + 15788
7   org.python.python   0x00010008acce
PyEval_EvalCodeEx + 1803
8   org.python.python   0x00010002c88f
PyClassMethod_New + 1666
9   org.python.python   0x0001aff3 PyObject_Call +
112
10  org.python.python   0x00010008a54e
PyEval_EvalFrameEx + 20380
11  org.python.python   0x00010008acce
PyEval_EvalCodeEx + 1803
12  org.python.python   0x00010002c88f
PyClassMethod_New + 1666
13  org.python.python   0x0001aff3 PyObject_Call +
112
14  org.python.python   0x00010008a54e
PyEval_EvalFrameEx + 20380
15  org.python.python   0x0001000892e1
PyEval_EvalFrameEx + 15663
16  org.python.python   0x0001000892e1
PyEval_EvalFrameEx + 15663
17  org.python.python   0x00010008acce
PyEval_EvalCodeEx + 1803
18  org.python.python   0x00010008935e
PyEval_EvalFrameEx + 15788
19  org.python.python   0x00010008acce
PyEval_EvalCodeEx + 1803
20  org.python.python   0x00010008ad61 PyEval_EvalCode
+ 54
21  org.python.python   0x0001000a265a Py_CompileString
+ 78
22  org.python.python   0x0001000a2723
PyRun_FileExFlags + 150
23  org.python.python   0x0001000a423d
PyRun_SimpleFileExFlags + 704
24  org.python.python   0x0001000b0286 Py_Main + 2718
25  org.python.python.app   0x00010e6c start + 52

Thread 1 Crashed:
0   org.python.python   0x00010009616e
PyArg_UnpackTuple + 8637
1   org.python.python   0x0001000967ca
_PyArg_ParseTupleAndKeywords_SizeT + 216
2   org.python.python   0x0001000660a9
PyUnicodeUCS2_FromFormat + 443
3   org.python.python   0x000100053aa2
PyType_GenericAlloc + 3114
4   org.python.python   0x0001aff3 PyObject_Call +
112
5   org.python.python   0x00010008a51a
PyEval_EvalFrameEx + 20328
6   org.python.python   0x00010008acce
PyEval_EvalCodeEx + 1803
7   org.python.python   0x00010002c8e1
PyClassMethod_New + 1748
8   org.python.python   0x0001aff3 PyObject_Call +
112
9   org.python.python   0x00010001a9df PyClass_New +
1575
10  org.python.python   0x0001aff3 PyObject_Call +
112
11  org.python.python   0x0001000849db
PyEval_CallObjectWithKeywords + 175
12  org.python.python   0x0001000520e7 _PyType_Lookup +
6568
13  org.python.python   0x00010003d44f PyObject_Repr +
108
14  org.python.python   0x000100017574
PyClass_IsSubclass + 3974
15  org.python.python   0x00010003d637 PyObject_Unicode
+ 334
16  org.python.python   0x0001000669a1
PyUnicodeUCS2_Format + 2217
17  org.python.python   0x0001c008 PySequence_Fast
+ 416
18  org.python.python   0x0001c469 PyNumber_Add +
218
19  org.python.python   0x00010008601d
PyEval_EvalFrameEx + 2667
20  org.python.python 

admin panel fieldsets for different type of users?

2010-08-01 Thread gondor
I use formset in my admin panel to group/title my related fields.
This works great except when I go to exclude some fields for lesser
users.

In the simple example below if i'm a super user all works great.
If i log in as a staff user thus the code exclude A formset I get the
following error:

Caught KeyError while rendering: Key 'A' not found in Form

I don't mind having a conditional formset but I don't know how to do
that based on the type of user.  Does anyone know how to solve this?

model.py

class Cars(models.Model):
  A = models.CharField('A', ...)
  B = models
  C = models...
  D = models...


admin.py

class CarsAdmin(admin.ModelAdmin):
  fieldsets = (_('first group'},{'fields':(('A','B'),('C','D'),)})
  def get_form(self,request,obj=None, **kwargs):
self.exclude = []
if not request.user.is_superuser:
   self.exclude.append('A')
return super(CarAdmin,self).get_form(request, obj=None, **kwargs)

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



Re: Crashing Dev Server (or Browser?)

2010-08-01 Thread Kev
rmschne wrote:

> I have  a small Django app that until now has been used simply for
> access to the data (in MySQL) for doing computations/reporting and
> outputting results to files.  Have not been using the ADMIN module or
> Dev server or anything.   Now that hard part of this work, I'm
> starting to get the admin app going.
>
> All the tables from the model are registered
> (admin.site.register(CLASSNAMEHERE)).  All works but for two  out of a
> dzon of the classes (tables in MySQL). For those two when I click the
> link in the admin page using latest version of Apple Mac Safari,
> *both* Safari and the dev server crash.  I can't tell which causes
> which, and frankly find it odd that either to affect the other like
> this.
>
> Running Django 1.2.1 and Python 2.6.1
>
> Any ideas?
>

Can you show us the output from the dev server, including any traceback?

Thanks,

Kev

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



Re: Django error can't adapt

2010-08-01 Thread Antoni Aloy
2010/8/1 Daniel França :
> Hi,
> I just migrated from Linux to Mac OS, and I'm getting an error message
> when I try register a new user of my django site, (at my page)
> I get the error: can't adapt type 'US/Eastern'
> I'm using Postgresql and psycopg2, I tried to change the TIME_ZONE to
> 'America/Sao_Paulo'(I'm in Brazil), but the error still happens.
>
> I tried anothers possibilities of TIME_ZONE but no success.
>
> Anyone know how to solve that?
>
> Best Regards,
> Daniel França
>
Do you have more than one django instance on mod_python? If this is
the case it's a bug with mod_python and Postgres. Change to wsgi and
the problem would dissapear.

Hope it helps!


-- 
Antoni Aloy López
Blog: http://trespams.com
Site: http://apsl.net

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



Crashing Dev Server (or Browser?)

2010-08-01 Thread rmschne
I have  a small Django app that until now has been used simply for
access to the data (in MySQL) for doing computations/reporting and
outputting results to files.  Have not been using the ADMIN module or
Dev server or anything.   Now that hard part of this work, I'm
starting to get the admin app going.

All the tables from the model are registered
(admin.site.register(CLASSNAMEHERE)).  All works but for two  out of a
dzon of the classes (tables in MySQL). For those two when I click the
link in the admin page using latest version of Apple Mac Safari,
*both* Safari and the dev server crash.  I can't tell which causes
which, and frankly find it odd that either to affect the other like
this.

Running Django 1.2.1 and Python 2.6.1

Any ideas?

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



Re: django-admin.py not working

2010-08-01 Thread Kev
ginost7 wrote:

> Im using ubuntu
>
> I managed to get through the poll project working on the django tut.
>  then tried another project
>
> At the prompt i get
>
> g...@gino-laptop:~/djangoDEV$ django-admin
> The program 'django-admin' is currently not installed.  You can
> install it by typing:
> sudo apt-get install python-django
>
> what is the matter?
>
>  I verified  that django is installed:
>
> g...@gino-laptop:~/djangoDEV$ python
> Python 2.6.4 (r264:75706, Dec  7 2009, 18:45:15)
> [GCC 4.4.1] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
 import django

>

Hello Gino,

On my ubuntu, django-admin is installed in /usr/bin:

k...@hera:~$ locate django-admin
/usr/bin/django-admin
/usr/lib/python-django/bin/django-admin.py
/usr/lib/python-django/bin/django-admin.pyc
/usr/share/doc/python-django-doc/html/ref/django-admin.html
/usr/share/man/man1/django-admin.1.gz
k...@hera:~$ echo $PATH
/home/kev/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

So you might want to check if django-admin exists in a location that is
not on your PATH.

Cheers,

Kev

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



JSON reponseText is undefined

2010-08-01 Thread Himanshu Srivastava
Hi
I am sending  a Json data from django on an ajax call as A
HttpResponse but i get it as undefined when i try to access it in
javascript
The code is as follows\

Views.py

data=simplejson.dump(dic)
return HttpResponse(data,mimetype='application/json')

Javascript

var ajaxRequest;
   try{
 // Opera 8.0+, Firefox, Safari
 ajaxRequest = new XMLHttpRequest();
  } catch (e){
// Internet Explorer Browsers
   try{
 ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (e) {
   try{
 ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (e){
// Something went wrong
  alert("Your browser broke!");
  return false;
 }
 }
 }
alert("Here");
 ajaxRequest.onreadystatechange = function(data){
 alert("ajax");
 if(ajaxRequest.readyState == 4){
  document.getElementById('State_Over').innerHTML=res.state_name;
  document.getElementById('Farming_Rate').innerHTML=res.Farming_Rate;

 }
 alert("out");
var infoToSend = encodeURI("?
state_id="+id+"&company_id="+document.getElementById('Hidden_Capital1'));
 ajaxRequest.open("GET", "http://localhost:8000/Software/update_state/";, true);
 ajaxRequest.setRequestHeader("Content-type",
"application/x-www-form-urlencoded");
 ajaxRequest.setRequestHeader("Content-length", infoToSend.length);
 ajaxRequest.setRequestHeader("Connection", "close");
 ajaxRequest.send(infoToSend);


PLEASE HELP SOON...
BYE

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