Application level data

2009-07-27 Thread vishy

Hi,

I have some data which I don't want to get from database for every
user request.How should I make such data available to all users(like
caching?)? What options are available in Django?

thanks
--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Models with behavior

2009-05-21 Thread vishy

Hi,

I have some functionality which needs to be part of a class,which I
don't want to persist in database.Where should I put such a class? In
models.py?

--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Unable to call custom method

2009-05-22 Thread vishy

Hi,
I am newbie at Django.I have model with a custom method.In view I am
retrieving a single object.See below --
My model
class Problem(models.Model):
problem = models.CharField(max_length=100)
solution=models.CharField(max_length=500)
def __unicode__(self):
return self.problem
   def retrieve_rankdata(self):
return self.problem.split()[0].split('/')

in view
I am doing this
def show(request):
   problem = Problem.objects.all()[0]
t1=problem.retrieve_rankdata()
But, I am getting this error
'Problem' object has no attribute 'retrieve_rankdata'

What am I doing wrong?
thanks


--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Unable to call custom method

2009-05-22 Thread vishy

thanks..no tabs for sure

On May 22, 6:40 pm, Karen Tracey  wrote:
> On Fri, May 22, 2009 at 8:11 AM, vishy  wrote:
>
> > Hi,
> > I am newbie at Django.I have model with a custom method.In view I am
> > retrieving a single object.See below --
> > My model
> > class Problem(models.Model):
> >    problem = models.CharField(max_length=100)
> >    solution=models.CharField(max_length=500)
> >    def __unicode__(self):
> >        return self.problem
> >   def retrieve_rankdata(self):
> >                return self.problem.split()[0].split('/')
>
> If this is an actual cut and paste: your retrieve_rankdata is not indented
> properly here. The 'def' needs to line up exactly with the other fields and
> methods defined in Problem.  It would be better form also to make its
> contents indented a consistent amount rather than having it be so much more
> dramatically indented than everything else.
>
> > in view
> > I am doing this
> > def show(request):
> >       problem = Problem.objects.all()[0]
> >        t1=problem.retrieve_rankdata()
> > But, I am getting this error
> > 'Problem' object has no attribute 'retrieve_rankdata'
>
> > What am I doing wrong?
>
> Fix the indentation and I expect the problem will go away.  Also, be careful
> not to mix tabs and spaces, that will also lead to difficulties in Python.
> Best to stick with spaces and never use tabs.
>
> Karen
--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Using forms to display multi-column table for input

2009-05-25 Thread vishy

Hi,
My requirement is to display a 2-column table (moves to be entered by
user for white and black of a chess game) with 10 rows for  input
(textbox).How can I use forms module to achieve this? Is it possible?
thanks
--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Best practice regarding sessions

2009-05-25 Thread vishy

Hi,

Are there any best practice regarding sessions in Django? Do yu
normally use db based sessions? What about using hidden element for
some scenarios, to maintain session?

regards
vishy
--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Django deployment

2009-06-03 Thread vishy

Hi,

I am developing an application on windows. I decided to upload it on
webfaction n see how deployment goes. The issues I faced was with
paths given -
for templates - I had given absolute path of directory on windows,
for database(using sqlite) - just the name.But, for deployment I had
to change both the paths. Is there any way which I can avoid this?

thanks
--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Using block content tag

2009-06-08 Thread vishy

Hi,

For my project, I decided to use base.html file.After including it in
a couple of pages, the layout has been altered? Why so? How does
blockcontent render?
thks
--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Using block content tag

2009-06-08 Thread vishy

well i had this html..


Feedback



Without using base.html, they rendered differently(in terms of
position) in browser.
On Jun 9, 11:26 am, Rama Vadakattu  wrote:
> >> the layout has been altered? Why so?
>
> What do you mean by this?
>
> On Jun 9, 11:24 am, vishy  wrote:
>
>
>
> > Hi,
>
> > For my project, I decided to use base.html file.After including it in
> > a couple of pages, the layout has been altered? Why so? How does
> > blockcontent render?
> > thks
--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Using block content tag

2009-06-09 Thread vishy

where can I see these files - which affect base.html?
thks

On Jun 9, 12:14 pm, Necmettin Begiter 
wrote:
> On Tue, Jun 9, 2009 at 09:29, vishy wrote:
> > Without using base.html, they rendered differently(in terms of
> > position) in browser.
>
> Which is normal, because base.html contains some positioning and CSS attached.
--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Installing 'south' on windows

2009-06-17 Thread vishy

Hi,

I have installed migration tool 'south' on windows.In settings.py,
what path I will have to give in installed apps? I just gave 'south'.
I got this error -
AttributeError: 'module' object has no attribute 'adminsouth'

thanks
--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Installing 'south' on windows

2009-06-17 Thread vishy

k, got it working
forgot a comma in setting file

On Jun 17, 2:35 pm, vishy  wrote:
> Hi,
>
> I have installed migration tool 'south' on windows.In settings.py,
> what path I will have to give in installed apps? I just gave 'south'.
> I got this error -
> AttributeError: 'module' object has no attribute 'adminsouth'
>
> thanks
--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Looking for guidance on django-registration

2009-12-12 Thread vishy
I have downloaded the latest module.Now,I need to set it up.I want
guidance,especially how to setup the templates, like what goes into
registration_form.html.If there is some source code that will be
great.
thanks

--

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: Looking for guidance on django-registration

2009-12-12 Thread vishy
got the registration working.Now, how to setup activation email?

On Dec 12, 9:41 pm, vishy  wrote:
> I have downloaded the latest module.Now,I need to set it up.I want
> guidance,especially how to setup the templates, like what goes into
> registration_form.html.If there is some source code that will be
> great.
> thanks

--

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.




Logging user actions

2010-08-02 Thread vishy
Hi,

I have a requirement to log all user actions like created new
order,user logged in,logged out etc including user ip address.And,it
should be displayed in admin section with admin logentries.Is there a
module which I can use? What about reversion?

thanks

-- 
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.



How to record users ip address every-time user logs in

2010-08-04 Thread vishy
Hi,

I want to record an entry in admin log,everytime a user logs in.How
can I do this.I am using django's default authentication modules.

thanks

-- 
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.



Customizing django admin

2010-08-08 Thread vishy
Hi,

For a modeladmin,I need to show a custom template when user adds or
edits.How can I go about implementing this functionality?

thanks

-- 
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.



How to troubleshoot path and permission problems?

2010-08-23 Thread vishy
Hi,

I am having issues with production server.Everything is running fine
on my local development server.On production site(using apache), CSS
files related to admin section are not being loaded.I have a feature
where admin can add products and upload images for the
product.But,when admin hits save,I get permission denied message.How
can I figure out what path problems are existing and how to fix them?
Thanks

-- 
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 troubleshoot path and permission problems?

2010-08-24 Thread vishy
I gave the permissions.But,still get this error
OSError Exception Value:[Errno 13] Permission denied: django

On Aug 23, 11:02 pm, Antoni Aloy  wrote:
> 2010/8/23 vishy :
>
> > Hi,
>
> > I am having issues with production server.Everything is running fine
> > on my local development server.On production site(using apache), CSS
> > files related to admin section are not being loaded.I have a feature
> > where admin can add products and upload images for the
> > product.But,when admin hits save,I get permission denied message.How
> > can I figure out what path problems are existing and how to fix them?
> > Thanks
>
> on linux ls -l will givve you the perisions of each file and folder.
> You can check what each letter means 
> onhttp://www.comptechdoc.org/os/linux/usersguide/linux_ugfilesp.html.
>
> To server files the Apache server has to have read permisions. To
> create files it has to have write permisions.
>
> Best regards,
>
> --
> 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.



Displaying uploaded image

2010-08-24 Thread vishy
I have media/customermedia folder where images are uploaded for
customer model.
To display this image,the customer has image_url method which
concatenates 'media_root' plus 'image'(which has value like
customermedia/name.gif).But,for some reason the image is not getting
displayed in img src tag.

-- 
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.



Extending LogEntry model

2010-08-31 Thread vishy
I  want to add a column  to the logentry model in admin section.How
can I do this?
thanks

-- 
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.



Custom view for admin section

2010-09-07 Thread vishy
Hi,

I have made a custom view for admin section.I have added a link in the
index page which calls this custom view.I have copied the index page
to templates\admin in my application, and added this link.But, I want
this link to appear in auth section.How can I do this?

thanks

-- 
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.



How to test activation email on windows?

2009-12-27 Thread vishy
Hi,

I have setup the registration module for a django project.Now, I want
to test the that activation email is sent.On windows, how can I test
this? How to send the email? Will I have to do any changes in
settings.py?

thanks

--

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.




Confused about GeoDjango and PostGIS

2012-04-25 Thread vishy
Hi,

I need to do spatial queries like find places within 5 miles of a
location given in latitude and longitude. So, I am thinking of
exploring PostGIS and GeoDjango. I have installed both. Now, I already
have a database which has a table for places with latitude and
longitude. Can I enable this db to use postgis and add column to this
table? Or, do I have to create a separate spatial db, create a table
with a column of geometry type and import data into that table (from
places table).? If I can use the existing database, how do I enable it
to use PostGIS?

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Confused about GeoDjango and PostGIS

2012-04-25 Thread vishy
So, the existing database cannot be used as a postgis db?

On Apr 25, 9:21 pm, Jeff Heard  wrote:
> Create a new spatial database and import the data.  That's by far your
> easiest option.  You'll need to create a POINT column (look at the PostGIS
> doc on how to add spatial columns) and then add rows either using the ORM
> or with a spatial query including something like this as part of the insert:
>
> GeomFromText('POINT(' + x + ' ' + y + ')', 4326)
>
> where 4326 is the spatial reference system for longitude/latitude.
>
>
>
>
>
>
>
> On Wed, Apr 25, 2012 at 11:17 AM, vishy  wrote:
> > Hi,
>
> > I need to do spatial queries like find places within 5 miles of a
> > location given in latitude and longitude. So, I am thinking of
> > exploring PostGIS and GeoDjango. I have installed both. Now, I already
> > have a database which has a table for places with latitude and
> > longitude. Can I enable this db to use postgis and add column to this
> > table? Or, do I have to create a separate spatial db, create a table
> > with a column of geometry type and import data into that table (from
> > places table).? If I can use the existing database, how do I enable it
> > to use PostGIS?
>
> > --
> > 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
> > 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-users@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: Confused about GeoDjango and PostGIS

2012-04-25 Thread vishy
Thanks.

On Apr 25, 11:07 pm, Jeff Heard  wrote:
> It can. I just usually consider it easier to create a new one
> On Apr 25, 2012 1:38 PM, "vishy"  wrote:
>
>
>
>
>
>
>
> > So, the existing database cannot be used as a postgis db?
>
> > On Apr 25, 9:21 pm, Jeff Heard  wrote:
> > > Create a new spatial database and import the data.  That's by far your
> > > easiest option.  You'll need to create a POINT column (look at the
> > PostGIS
> > > doc on how to add spatial columns) and then add rows either using the ORM
> > > or with a spatial query including something like this as part of the
> > insert:
>
> > > GeomFromText('POINT(' + x + ' ' + y + ')', 4326)
>
> > > where 4326 is the spatial reference system for longitude/latitude.
>
> > > On Wed, Apr 25, 2012 at 11:17 AM, vishy  wrote:
> > > > Hi,
>
> > > > I need to do spatial queries like find places within 5 miles of a
> > > > location given in latitude and longitude. So, I am thinking of
> > > > exploring PostGIS and GeoDjango. I have installed both. Now, I already
> > > > have a database which has a table for places with latitude and
> > > > longitude. Can I enable this db to use postgis and add column to this
> > > > table? Or, do I have to create a separate spatial db, create a table
> > > > with a column of geometry type and import data into that table (from
> > > > places table).? If I can use the existing database, how do I enable it
> > > > to use PostGIS?
>
> > > > --
> > > > 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
> > > > 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-users@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-users@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: Confused about GeoDjango and PostGIS

2012-04-25 Thread vishy
thanks

On Apr 25, 11:07 pm, Jeff Heard  wrote:
> It can. I just usually consider it easier to create a new one
> On Apr 25, 2012 1:38 PM, "vishy"  wrote:
>
>
>
>
>
>
>
> > So, the existing database cannot be used as a postgis db?
>
> > On Apr 25, 9:21 pm, Jeff Heard  wrote:
> > > Create a new spatial database and import the data.  That's by far your
> > > easiest option.  You'll need to create a POINT column (look at the
> > PostGIS
> > > doc on how to add spatial columns) and then add rows either using the ORM
> > > or with a spatial query including something like this as part of the
> > insert:
>
> > > GeomFromText('POINT(' + x + ' ' + y + ')', 4326)
>
> > > where 4326 is the spatial reference system for longitude/latitude.
>
> > > On Wed, Apr 25, 2012 at 11:17 AM, vishy  wrote:
> > > > Hi,
>
> > > > I need to do spatial queries like find places within 5 miles of a
> > > > location given in latitude and longitude. So, I am thinking of
> > > > exploring PostGIS and GeoDjango. I have installed both. Now, I already
> > > > have a database which has a table for places with latitude and
> > > > longitude. Can I enable this db to use postgis and add column to this
> > > > table? Or, do I have to create a separate spatial db, create a table
> > > > with a column of geometry type and import data into that table (from
> > > > places table).? If I can use the existing database, how do I enable it
> > > > to use PostGIS?
>
> > > > --
> > > > 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
> > > > 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-users@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-users@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: Confused about GeoDjango and PostGIS

2012-04-25 Thread vishy
Yes, I just ran  the 2 scripts  in my current database -
spatial_ref_sys.sql and postgis.sql. Seems to work. I am able to
define a geometry column in my current existing table.

On Apr 25, 11:03 pm, George Silva  wrote:
> Yes it can, as long PostGIS is installed.
>
>
>
>
>
>
>
>
>
> On Wed, Apr 25, 2012 at 2:37 PM, vishy  wrote:
> > So, the existing database cannot be used as a postgis db?
>
> > On Apr 25, 9:21 pm, Jeff Heard  wrote:
> > > Create a new spatial database and import the data.  That's by far your
> > > easiest option.  You'll need to create a POINT column (look at the
> > PostGIS
> > > doc on how to add spatial columns) and then add rows either using the ORM
> > > or with a spatial query including something like this as part of the
> > insert:
>
> > > GeomFromText('POINT(' + x + ' ' + y + ')', 4326)
>
> > > where 4326 is the spatial reference system for longitude/latitude.
>
> > > On Wed, Apr 25, 2012 at 11:17 AM, vishy  wrote:
> > > > Hi,
>
> > > > I need to do spatial queries like find places within 5 miles of a
> > > > location given in latitude and longitude. So, I am thinking of
> > > > exploring PostGIS and GeoDjango. I have installed both. Now, I already
> > > > have a database which has a table for places with latitude and
> > > > longitude. Can I enable this db to use postgis and add column to this
> > > > table? Or, do I have to create a separate spatial db, create a table
> > > > with a column of geometry type and import data into that table (from
> > > > places table).? If I can use the existing database, how do I enable it
> > > > to use PostGIS?
>
> > > > --
> > > > 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
> > > > 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-users@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.
>
> --
> George R. C. Silva
>
> Desenvolvimento em 
> GIShttp://geoprocessamento.nethttp://blog.geoprocessamento.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-users@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.



Unable to get result using distance query

2012-04-25 Thread vishy
Hi,

I am using PointField to store longitude and latitude with SRID 4326.
All my places are in USA. Now, given a reference point, I do

   lat = "41.881944"
   lng = "-87.627778"

ref_pnt = fromstr("POINT(%s %s)" % (lng, lat))
distance_from_point = {'m':'50'}
r_gis =
PLaces.objects.filter(poly__distance_lte=(ref_pnt,D(**distance_from_point)))


But, I am getting an error

   DatabaseError: Coordinate values are out of range [-180 -90,
180 90] for GEOGRAHY type

What is wrong?

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Confused about GeoDjango and PostGIS

2012-04-25 Thread vishy
thanks. This is what I have done.

On Apr 26, 9:57 am, Jani Tiainen  wrote:
> 25.4.2012 19:17, vishy kirjoitti:
>
> > Hi,
>
> > I need to do spatial queries like find places within 5 miles of a
> > location given in latitude and longitude. So, I am thinking of
> > exploring PostGIS and GeoDjango. I have installed both. Now, I already
> > have a database which has a table for places with latitude and
> > longitude. Can I enable this db to use postgis and add column to this
> > table? Or, do I have to create a separate spatial db, create a table
> > with a column of geometry type and import data into that table (from
> > places table).? If I can use the existing database, how do I enable it
> > to use PostGIS?
>
> It depends on your environment but basic workflow is same is in *nix
> instructions. And it's not even hard. :
>
> createdb yourdatabase
> createlang plpgsql yourdatabase
> psql -d yourdatabase -f postgis.sql
> psql -d yourdatabase -f postgis_comments.sql
> psql -d yourdatabase -f spatial_ref_sys.sql
>
> Of course in your case you can skip creation of database. Just create
> language and install postgis stuff.
>
> After that you need to make sure that your database user has access to
> geometry_columns and spatial_ref_sys tables.
>
> Add new column (For PostGIS 1.5.x, newer postgis has simpler alternative
> syntax):
>
> SELECT AddGeometryColumn('my_table', 'my_geom', 4326, 'POINT', 2)
>
> And after that just update new geometry column:
> update my_table set my_geom = GeomFromText('POINT(' + x + ' ' + y +')',
> 4326)
>
> And don't forget to commit. If you have lot's of geometries (1M+) you
> probably want to drop out spatial index and recreate it afterwards.
> Otherwise building index takes just long time.
>
> --
> Jani Tiainen
>
> - Well planned is half done and a half done has been sufficient before...

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Confused about GeoDjango and PostGIS

2012-04-26 Thread vishy
I am having trouble converting latitude and longitude. Both are in
double precision in the table.
So, I am doing this

UPDATE my_table
SET geom = ST_PointFromText('POINT(' || longitude ||' '|| latitude
||')', 4326)

But, when I do this

SELECT ST_PointFromText(geom ) FROM my_table

I am getting an error
ERROR:  parse error - invalid geometry
HINT:  "010120E610D" <-- parse error at position 19 within
geometry
CONTEXT:  SQL function "st_pointfromtext" statement 1




thanks

On Apr 26, 9:57 am, Jani Tiainen  wrote:
> 25.4.2012 19:17, vishy kirjoitti:
>
> > Hi,
>
> > I need to do spatial queries like find places within 5 miles of a
> > location given in latitude and longitude. So, I am thinking of
> > exploring PostGIS and GeoDjango. I have installed both. Now, I already
> > have a database which has a table for places with latitude and
> > longitude. Can I enable this db to use postgis and add column to this
> > table? Or, do I have to create a separate spatial db, create a table
> > with a column of geometry type and import data into that table (from
> > places table).? If I can use the existing database, how do I enable it
> > to use PostGIS?
>
> It depends on your environment but basic workflow is same is in *nix
> instructions. And it's not even hard. :
>
> createdb yourdatabase
> createlang plpgsql yourdatabase
> psql -d yourdatabase -f postgis.sql
> psql -d yourdatabase -f postgis_comments.sql
> psql -d yourdatabase -f spatial_ref_sys.sql
>
> Of course in your case you can skip creation of database. Just create
> language and install postgis stuff.
>
> After that you need to make sure that your database user has access to
> geometry_columns and spatial_ref_sys tables.
>
> Add new column (For PostGIS 1.5.x, newer postgis has simpler alternative
> syntax):
>
> SELECT AddGeometryColumn('my_table', 'my_geom', 4326, 'POINT', 2)
>
> And after that just update new geometry column:
> update my_table set my_geom = GeomFromText('POINT(' + x + ' ' + y +')',
> 4326)
>
> And don't forget to commit. If you have lot's of geometries (1M+) you
> probably want to drop out spatial index and recreate it afterwards.
> Otherwise building index takes just long time.
>
> --
> Jani Tiainen
>
> - Well planned is half done and a half done has been sufficient before...

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: filtering drop downs according to logged in user

2011-04-22 Thread vishy


On Apr 21, 7:10 pm, "Szabo, Patrick \(LNG-VIE\)"
 wrote:
> Hi,
>
> I want to filter the dropdownlists that are automatically used to select
> a foreign-key in forms (in my views).
>
> Normally that could easily be done with "class Meta" in the Modelform.
>
> Thing is i want to filter by an attribute of the current
> userspecificly the groups that the user is assigned to.
>
> So how do i do that ?!
>
> Can i acces request.user in the models somehow ?!
>
> Kind regards
>
> . . . . . . . . . . . . . . . . . . . . . . . . . .
> Patrick Szabo
>  XSLT Developer
> LexisNexis
> Marxergasse 25, 1030 Wien
>
> mailto:patrick.sz...@lexisnexis.at
> Tel.: +43 (1) 534 52 - 1573
> Fax: +43 (1) 534 52 - 146

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: filtering drop downs according to logged in user

2011-04-22 Thread vishy
test

On Apr 21, 7:10 pm, "Szabo, Patrick \(LNG-VIE\)"
 wrote:
> Hi,
>
> I want to filter the dropdownlists that are automatically used to select
> a foreign-key in forms (in my views).
>
> Normally that could easily be done with "class Meta" in the Modelform.
>
> Thing is i want to filter by an attribute of the current
> userspecificly the groups that the user is assigned to.
>
> So how do i do that ?!
>
> Can i acces request.user in the models somehow ?!
>
> Kind regards
>
> . . . . . . . . . . . . . . . . . . . . . . . . . .
> Patrick Szabo
>  XSLT Developer
> LexisNexis
> Marxergasse 25, 1030 Wien
>
> mailto:patrick.sz...@lexisnexis.at
> Tel.: +43 (1) 534 52 - 1573
> Fax: +43 (1) 534 52 - 146

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Some beginners question

2011-01-30 Thread vishy
1) I want to read files. Where should I put these files? I am not using a 
model to link to the files. And how to discover the path to files? I am 
working on windows, and in development environment I am using the full path 
to the file.
2) I created my own custom classes, but when I import into views.py, I get 
module not found. Why so? My custom classes are inside 
application\myclassfolder.

thanks

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.