Re: about QuerySet

2012-01-31 Thread newme
do you mean that queryset will query database every time i call user[0]? On 1月30日, 午前9:29, akaariai wrote: > On Jan 20, 10:12 am, newme wrote: > > > user = User.objects.filter(pk="") > > user is a QuerySet > > > every time i call user[0], i returns a different reference. > > > maybe it shoul

Re: online transactions with python

2012-01-31 Thread diego velasquez
Thanks guys, I use Satchmo by the moment but my I'm interested in some project with protocols differents with some exclusive credit cards (VISA, MasterCard, Dinners Club)... This part of the project is very difficult but I'm thinking to do something more general or more pleasant for customers and

Re: GIS Distance from Point to Geometry Collection

2012-01-31 Thread Jeff Heard
It should return whatever the units are in the coordinate system you have set. You will probably want to transform the geometry to UTM first. Something that treats the geometry as flat and sets distance to be in meters or similar. srid=3857 or 900913 will do this nicely (caveat emptor). -- Jeff

Re: Creating a hierarchy of objects in my api.py

2012-01-31 Thread Stanwin Siow
Hello, Any luck on this yet? Best Regards, Stanwin Siow On Jan 31, 2012, at 11:39 AM, St@n wrote: > Hello, > > I am playing around with tastypie and i want to create a hierarchy of > data. > > What i currently have is this: > > > class keywordResource(ModelResource): >tweets = fields

Re: GIS Distance from Point to Geometry Collection

2012-01-31 Thread Alex Kopp
Yes Jeff, this is what I want to do. I wasn't sure if there was an easier way. What units does the distance function return? I tried this and it seems to return the distance in units of 10km, is this correct? Thanks again! On Tue, Jan 31, 2012 at 9:04 PM, Jeff Heard wrote: > Got it. So what you

Re: GIS Distance from Point to Geometry Collection

2012-01-31 Thread Jeff Heard
Got it. So what you want to do is a list comprehension over the geometry object, which *should* give you individual geometries is what it sounds like. Then you can calculate distance() from each of these. Something like this? interesting_point = Point(x, y) collection = result.geom min_dist = m

Re: GIS Distance from Point to Geometry Collection

2012-01-31 Thread Alex Kopp
Here's a more concrete example, say I am storing shapes of all countries. Now, the US can't be stored in one polygon (we have hawaii and alaska), therefore I have to store the many polygons in one geometrycollection. Now, say I have another point on the map, I would like to know how ar it is from

Re: GIS Distance from Point to Geometry Collection

2012-01-31 Thread Alex Kopp
Perhaps I didn't explain it well, Jeff. I am just trying to get the smallest distance from one point to any of the points, lines, or polygons inside of a queryset. The data I am receiving from the queryset is a geometrycollection already... That is how it is being stored in the database. On Tue, J

Re: GIS Distance from Point to Geometry Collection

2012-01-31 Thread Jeff Heard
You should be able to create a geometrycollection object from a queryset (you may have to use a list comprehension for this), then calculate the centroid and take the distance from that. Taking the distance from the edge should only be a little more Complicated. Check the django GEOS API docs F

Using Context Processor as form with HttpResponseRedirect

2012-01-31 Thread richard
Hi i have seen alot of people saying to use a context processor to include forms in multiple page. I have written a context processor login form that just returns the django Authentication form and everything works great including the form.errors etc except that I cant seem to redirect from the con

Re: Testing

2012-01-31 Thread Russell Keith-Magee
Another option, if you're using unittest2 (and if you're using Django's TestCase, you're using unittest2) is assertIn -- self.assertIn(first, [one_value, another_value]) Yours, Russ Magee %-) On 01/02/2012, at 8:42 AM, Furbee wrote: > I think you can do something like: > assertTrue(fi

Re: Testing

2012-01-31 Thread Furbee
I think you can do something like: assertTrue(first == one_value or first == second_value) At the same time, when unit testing, you should really know exactly what a value returned from a method is. Furbee On Tue, Jan 31, 2012 at 4:32 PM, xino12 wrote: > Hello, I'm doing unitTesting and I

Testing

2012-01-31 Thread xino12
Hello, I'm doing unitTesting and I want to know if it's possible to accept more than one value in the assetEqual method. Maybe this works assertEqual(first, one_value or another_value) Sorry but I'm new programming with django. Lots of thanks, Rubén -- You received this message because you a

GIS Distance from Point to Geometry Collection

2012-01-31 Thread Loafer
I have a model that currently stores a Geographic Point (Using Django GIS (GeoDjango)) and another model that has a field to store a geometry collection (A collection of polygons, lines, and or points). I am trying to find the distance from the point to any one of the shapes in the geometry collec

Django Model Errors : TypeError: 'class Meta' got invalid attribute(s): using

2012-01-31 Thread Subhodip Biswas
Hi all, I am newbie in django and while trying to write a database router for using multiple database I did something like : class Meta: using = 'somedatabasename' in Django models.py. However while doing a syncdb I get an error like this : TypeError: 'class Meta' got invalid a

Re: Django Admin completely empty

2012-01-31 Thread Joel Goldstick
On Jan 30, 5:14 pm, darwin_tech wrote: > hmmm. I am the superuser, but I went ahead and tried the createuser > command to make another. Still the same in the admin. No models or > user/privilege options. The strange thing is there are boxes where you > would expect apps/models top be, but they a

Re: Problem with admin

2012-01-31 Thread Daniel Roseman
On Tuesday, 31 January 2012 20:04:33 UTC, Kolbe wrote: > > Hi guys, I created a new app and within that app, I also specified a > new admin.py file. Is that how the admin portion for that app is > managed? > > Anyway, after I created my models and syncdb, then run server, I have > been unable

Re: Help using index view to render registration form from registration app

2012-01-31 Thread Jenna Pullen
Hi Dennis, thanks for the reply. The index / root of my site will contain the registration page for new users to sign up and contain a login page for people who are already registered to log in. so yes i would want this functionality on the default page and not have to redirect to a specific regis

Problem with admin

2012-01-31 Thread Kolbe
Hi guys, I created a new app and within that app, I also specified a new admin.py file. Is that how the admin portion for that app is managed? Anyway, after I created my models and syncdb, then run server, I have been unable to access the admin gui. I keep getting this error below, but I don't un

Re: I need help with Python Tools for Visual Studio 2010 and Django

2012-01-31 Thread Daniel Roseman
On Tuesday, 31 January 2012 18:38:18 UTC, JJ Zolper wrote: > > Sam, > > Since I'm on Ubuntu know with my Python and Django I'm wondering which > CPython I should download? > > I saw stackless python on the python.org site but I'm not sure if that's > what CPython version I would need. I thought t

Re: I need help with Python Tools for Visual Studio 2010 and Django

2012-01-31 Thread JJ Zolper
Sam, Since I'm on Ubuntu know with my Python and Django I'm wondering which CPython I should download? I saw stackless python on the python.org site but I'm not sure if that's what CPython version I would need. I thought there was a standard CPython? Any help about my interpreter for Python on

Help using index view to render registration form from registration app

2012-01-31 Thread richard
Hi if anyone could point me in the right direction it would be greatly appreciated. Basically i have my index view which renders to index.html the main page for a site. I need to know the best practice to have my index view contain the registration form from django the registration app so when the

django-private-views

2012-01-31 Thread Tom Christie
Useful little package for y'all, written by Julien Phalip, which I've packaged and pushed to PyPI. django-private-views - https://github.com/dabapps/django-private-views Inverts the usual @login_required logic, and instead makes all your views private by default, and gives you a @login_not_requ

Re: online transactions with python

2012-01-31 Thread Markus Gattol
https://github.com/agiliq/merchant the braintree backend is good, so is stripe. Depends on your type of transaction and the pricing you get. -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://group

Re: Question regarding ticket #17062

2012-01-31 Thread Ashe
> If you don't want to use a custom version of Django, and can't wait > for 1.4, you should be able to set the time zone for per database > user. Connect to the database with your database user, and do this: > ALTER USER "thedbuser" SET TIME ZONE 'wanted_zone'; -- where > wanted_zone would be UTC f

Re: Django Caching appended character issue

2012-01-31 Thread Aaron Cannon
If it was a BOM issue, wouldn't it get prepended? Unfortunately, I don't have any better ideas either. Aaron -- This message was sent from a mobile device On Jan 31, 2012, at 7:56, Ustun Ozgur wrote: > No idea actually, but I would look for BOM related issues. > > Ustun > -- > You receive

Re: field name hiding workaround

2012-01-31 Thread Michael Elkins
On Tue, Jan 31, 2012 at 07:59:38AM -0800, Jaroslav Dobrek wrote: class Lexeme(models.Model): class Meta: unique_together = ((u"entity", u"language"),) I beleive this will not work because Lexeme is not abstract, and it has no 'entity' field. language = models.ForeignKey(Langua

Re: Dynamic runtime modeling: which is the best choice?

2012-01-31 Thread Alessandro Candini
Unfortunately I deal with very different shapefiles and I create models on the fly with ogrinspect tool. I cannot know the shapefile structure, before user upload: for this reason a table per shape is IMHO mandatory (as well as a clearer approach). Are you sure you need a new model for every s

field name hiding workaround

2012-01-31 Thread Jaroslav Dobrek
Hello, I have got a class Lexeme which I would like to define as follows: class Lexeme(models.Model): class Meta: unique_together = ((u"entity", u"language"),) language = models.ForeignKey(Language) # ... I would like to have different types of lexemes, each of which has

Re: Dynamic runtime modeling: which is the best choice?

2012-01-31 Thread Andres Reyes
Are you sure you need a new model for every shape your user inserts? Most likely you need to design a generic models in which you would insert new rows for every shape. I mean generic in the sense that it is designed to contain different shapes not any special Django or Python stuff 2012/1/31 Ale

Re: Django Caching appended character issue

2012-01-31 Thread Ustun Ozgur
No idea actually, but I would look for BOM related issues. Ustun -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/YpAgjT_A98MJ. To post to this group, send

Re: Displaying template location in html

2012-01-31 Thread Ustun Ozgur
+1 for debug toolbar. If you choose to do it manually though, you can make use of a middleware instead of passing templates in each view function explicitly, as shown here: http://djangosnippets.org/snippets/766/ Ustun -- You received this message because you are subscribed to the Google Gr

Re: ANN: OGC Web Feature Service for GeoDjango

2012-01-31 Thread George Silva
Wow! Congratulations on this release. I'm looking at it right now. :D On Tue, Jan 31, 2012 at 1:11 PM, Jeff Heard wrote: > https://github.com/JeffHeard/ga_ows > > http://geoanalytics.renci.org/uncategorized/ogc-wfs-for-django-released-on-github/ > > It's not feature complete yet by any means, b

Dynamic runtime modeling: which is the best choice?

2012-01-31 Thread Alessandro Candini
Hi list. I need to create an app in which the user can upload a shapefile, which must be stored in a database table with LayerMapping from django.contrib.gis.utils, as explained here: https://docs.djangoproject.com/en/dev/ref/contrib/gis/tutorial/#layermapping The problem is that I need to upd

ANN: OGC Web Feature Service for GeoDjango

2012-01-31 Thread Jeff Heard
https://github.com/JeffHeard/ga_ows http://geoanalytics.renci.org/uncategorized/ogc-wfs-for-django-released-on-github/ It's not feature complete yet by any means, but it is quite usable. There is also an implementation of WMS included, but it is currently undocumented as I clean up that code and

Re: online transactions with python

2012-01-31 Thread Marc Aymerich
On Tue, Jan 31, 2012 at 5:43 AM, jj_Diego wrote: > Well... > > I'm form Perú and nowadays I'm working with my friends on a proyect > based on python... > > but our first difficulty its the online transactions using  credit > cards (visa, mastercard, diners club) in aweb store > > If anybody knows

online transactions with python

2012-01-31 Thread jj_Diego
Well... I'm form Perú and nowadays I'm working with my friends on a proyect based on python... but our first difficulty its the online transactions using credit cards (visa, mastercard, diners club) in aweb store If anybody knows something or can help me... please send me an email. Thanks -

Re: Displaying template location in html

2012-01-31 Thread Alec Taylor
Thanks donarb, I'll give that toolbar a try. Mario: I though Python has all that fancy metaprogramming stuff like Ruby with Objective C style reflection? On Mon, Jan 30, 2012 at 12:19 PM, donarb wrote: > Use the Django Debug Toolbar, it shows all kinds of things. For > templates, it shows the na

Django and Zinnia blogpost

2012-01-31 Thread Gaus
Hi all I am presently setting up my shop using satchmo. I managed to integrate zinnia for my blogging. I am looking forward to integrate on how to embed youtube video using zinnia blogpost. Has anyone come across this requirement and help me out of this please..? ++ -- You received this message