Tuesday, January 31, 2012

Re: about QuerySet

do you mean that queryset will query database every time i call
user[0]?

On 1月30日, 午前9:29, akaariai <akaar...@gmail.com> wrote:
> On Jan 20, 10:12 am, newme <dllizh...@gmail.com> wrote:
>
> > user = User.objects.filter(pk="XXXX")
> > user is a QuerySet
>
> > every time i call user[0], i returns a different reference.
>
> > maybe it should be a python question.
> > i want to know i QuerySet does that.
>
> The reason is that Django does not do "instance caching". That is, you
> will get different reference each time from a queryset because that is
> how it works. If you need to use the same instance, then you need to
> store that somewere yourself. This is all the help I can give based on
> your question.
>
>  - Anssi

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

Re: online transactions with python

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 sellers, and thanks for the information posted in github. They are very
helpful for me

I will write more comments during the project

See you!!

--
Diego Velásquez Ríos
Movistar   :  959920238
RPM        :  #991205

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

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

On Tue, 31 Jan 2012 20:33:56 +0000, Jenna Pullen
<pullenjenna10@gmail.com> wrote:

>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 registration url for member to register.
>

I still have the impression you are putting the cart before the
horse.

Let me make a few assumptions about the typical web site, and see
what implications I can infer:

* your site will have multiple subpages with different content per
page.

* all content pages require a viewer to be "logged in" (have a valid
session cookie, or whatever the authentication scheme uses)

* session cookies have some expiration time

* users (who are out of your control) can bookmark any subpage URL in
order to return to that page quickly, bypassing any site navigation

implies
=> ANY page URL might be requested by someone who does not have a
current/valid authentication session cookie

This means that handlers for all "normal" content pages must include
the ability to redirect non-authenticated users to a "log in" page; and
to be friendly, after a valid log-in, that page should return them to
the URL they initially requested and not some top-level of your site.

Since all pages need to handle this action, making the root of the
web site a log-in/registration page is somewhat futile (besides which,
if a user WITH a session cookie reenters your root URL, your "log in"
page is going to have to detect that cookie and redirect to some other
top-level page).

Also note that my prior response never said that your page would
redirect to a registration page. Rather it was that the log-in page
would have a button or link /to/ a registration page for new users.
Otherwise you end up with a log-in page handler that has to
differentiate between a log-in and a registration.

#pseudo-code
sessionkey = None
if username and password:
if validate(username, password):
sessionkey = newcookie()
else:
#INVALID LOGIN
else:
if allregistrationdatasupplied(*args):
if noconflict(newusername):
addnewusertodatabase(*args):
sessionkey = newcookie()
else:
#USER NAME ALREADY IN USE
else:
#MISSING REGISTRATION DATA

if sessionkey:
#return top-level page and session cookie
else:
#redisplay log-in/registration page with added error message
--
Wulfraed Dennis Lee Bieber AF6VN
wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.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-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: GIS Distance from Point to Geometry Collection

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

On Tue, Jan 31, 2012 at 9:07 PM, Alex Kopp <loaferdtd@gmail.com> wrote:
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 <jefferson.r.heard@gmail.com> wrote:
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 = min([g.distance(interesting_point) for g in collection])

or for every geometrycollection in a queryset:

result = MyModel.objects.all()
min_dist = min([min([g.distance(interesting_point) for g in coll]) for coll in result])

Brute force and thus a bit slow, but it should work if I understand you correctly...

-- Jeff


On Tue, Jan 31, 2012 at 8:45 PM, Alex Kopp <loaferdtd@gmail.com> wrote:
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 ANY of the polygons...


On Tue, Jan 31, 2012 at 8:41 PM, Alex Kopp <loaferdtd@gmail.com> wrote:
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, Jan 31, 2012 at 8:36 PM, Jeff Heard <jefferson.r.heard@gmail.com> wrote:
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 For complete details



On Jan 31, 2012, at 6:36 PM, Loafer <loaferdtd@gmail.com> wrote:

> 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 collection. Apparently the distance function
> only works on single shapes, not a collection. Are there any
> workarounds to this?
>
> Any help is appreciated.
>
> 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+unsubscribe@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+unsubscribe@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+unsubscribe@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+unsubscribe@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+unsubscribe@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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

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

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.ToManyField(timelineResource, 'tweets', full=True)
   class Meta:
       queryset = Keyword.objects.all()
       resource_name = 'keyword'
       excludes = ['id', 'keyword_id']
       include_resource_uri = False

   def alter_list_data_to_serialize(self, request, data_dict):
       if isinstance(data_dict, dict):
           if 'meta' in data_dict:
               # Get rid of the "meta".
               del(data_dict['meta'])
               # Rename the objects.
               data_dict['keyword'] = copy.copy(data_dict['objects'])
               del(data_dict['objects'])
       return data_dict



Can someone explain the relationship to me in creating such a
hierarchy?

in the line tweets = fields.ToManyField(timelineResource, 'tweets',
full=True)

it means that timelineResource is a child of Keyword right? and
"tweets" would be the column name in timeline table or just a generic
name?

or must i map a matching column that appears in both tables (keyword,
timeline)?


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


Re: GIS Distance from Point to Geometry Collection

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 <jefferson.r.heard@gmail.com> wrote:
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 = min([g.distance(interesting_point) for g in collection])

or for every geometrycollection in a queryset:

result = MyModel.objects.all()
min_dist = min([min([g.distance(interesting_point) for g in coll]) for coll in result])

Brute force and thus a bit slow, but it should work if I understand you correctly...

-- Jeff


On Tue, Jan 31, 2012 at 8:45 PM, Alex Kopp <loaferdtd@gmail.com> wrote:
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 ANY of the polygons...


On Tue, Jan 31, 2012 at 8:41 PM, Alex Kopp <loaferdtd@gmail.com> wrote:
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, Jan 31, 2012 at 8:36 PM, Jeff Heard <jefferson.r.heard@gmail.com> wrote:
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 For complete details



On Jan 31, 2012, at 6:36 PM, Loafer <loaferdtd@gmail.com> wrote:

> 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 collection. Apparently the distance function
> only works on single shapes, not a collection. Are there any
> workarounds to this?
>
> Any help is appreciated.
>
> 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+unsubscribe@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+unsubscribe@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+unsubscribe@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+unsubscribe@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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: GIS Distance from Point to Geometry Collection

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 = min([g.distance(interesting_point) for g in collection])

or for every geometrycollection in a queryset:

result = MyModel.objects.all()
min_dist = min([min([g.distance(interesting_point) for g in coll]) for coll in result])

Brute force and thus a bit slow, but it should work if I understand you correctly...

-- Jeff


On Tue, Jan 31, 2012 at 8:45 PM, Alex Kopp <loaferdtd@gmail.com> wrote:
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 ANY of the polygons...


On Tue, Jan 31, 2012 at 8:41 PM, Alex Kopp <loaferdtd@gmail.com> wrote:
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, Jan 31, 2012 at 8:36 PM, Jeff Heard <jefferson.r.heard@gmail.com> wrote:
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 For complete details



On Jan 31, 2012, at 6:36 PM, Loafer <loaferdtd@gmail.com> wrote:

> 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 collection. Apparently the distance function
> only works on single shapes, not a collection. Are there any
> workarounds to this?
>
> Any help is appreciated.
>
> 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+unsubscribe@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+unsubscribe@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+unsubscribe@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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: GIS Distance from Point to Geometry Collection

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 ANY of the polygons...

On Tue, Jan 31, 2012 at 8:41 PM, Alex Kopp <loaferdtd@gmail.com> wrote:
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, Jan 31, 2012 at 8:36 PM, Jeff Heard <jefferson.r.heard@gmail.com> wrote:
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 For complete details



On Jan 31, 2012, at 6:36 PM, Loafer <loaferdtd@gmail.com> wrote:

> 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 collection. Apparently the distance function
> only works on single shapes, not a collection. Are there any
> workarounds to this?
>
> Any help is appreciated.
>
> 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+unsubscribe@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+unsubscribe@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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: GIS Distance from Point to Geometry Collection

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, Jan 31, 2012 at 8:36 PM, Jeff Heard <jefferson.r.heard@gmail.com> wrote:
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 For complete details



On Jan 31, 2012, at 6:36 PM, Loafer <loaferdtd@gmail.com> wrote:

> 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 collection. Apparently the distance function
> only works on single shapes, not a collection. Are there any
> workarounds to this?
>
> Any help is appreciated.
>
> 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+unsubscribe@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+unsubscribe@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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: GIS Distance from Point to Geometry Collection

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 For complete details

On Jan 31, 2012, at 6:36 PM, Loafer <loaferdtd@gmail.com> wrote:

> 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 collection. Apparently the distance function
> only works on single shapes, not a collection. Are there any
> workarounds to this?
>
> Any help is appreciated.
>
> 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+unsubscribe@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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Using Context Processor as form with HttpResponseRedirect

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 context processor after is_valid is
called. Are context processors not supposed ot be used in this way? My
thoughts inititally were that if it seems to support a request and can
do the validation why not? Basically stuck on using
HttpResponseRedirect in a context processor. I have managed to get
this working by passing a variable called redirect in the dictionary
returned to my template and then saying if the redirect tag is
available use the browsers meta tag to redirect me but i dont think
this is the way it should work. code below please advise thanks.

context_processors.py

from django.contrib.auth.forms import AuthenticationForm
from django.http import HttpResponseRedirect


def login_form(request):
if request.method == 'POST':
form = AuthenticationForm(data=request.POST)
if form.is_valid():
#return HttpResponseRedirect('/home') ONLY THING THATS NOT
WORKING
return {'login_form': form, 'redirect': '/home'}
else:
form = AuthenticationForm(request)
return {'login_form': form}

template.html
{{ form.non_field_errors}} # works fine after post with errors showing
{{ form.username}}
{{ form.password}}
{% if redirect %}
<meta http-equiv="REFRESH" content="0;url={{ redirect }}">
{% endif %}

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

Re: Testing

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

Re: Testing

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

Testing

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

GIS Distance from Point to Geometry Collection

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 collection. Apparently the distance function
only works on single shapes, not a collection. Are there any
workarounds to this?

Any help is appreciated.

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

Re: Django Admin completely empty

On Jan 30, 5:14 pm, darwin_tech <cronnelocto...@gmail.com> 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 are totally empty.
>
> Any other suggestions?
>
> Sam
>
> On Jan 30, 3:40 pm, Andres Reyes <armo...@gmail.com> wrote:
>
>
>
>
>
>
>
> > Do you have permissions on the models you want to see?
>
> > You can create a new superuser with
> > python manage.py createsuperuser
>
> > 2012/1/30 darwin_tech <cronnelocto...@gmail.com>:
>
> > > Hi,
>
> > > On my development server my Django Admin works as expected, showing
> > > all my
> > > models and the auth models. However, on the production server, even
> > > though the whole application works fine, when I log into the admin I
> > > see nothing. No models, no auth. Just a stack of empty boxes.
> > > If anyone has any idea as to why this might be, your input would be
> > > much appreciated.
>
> > > Sam

Look at the source of the page. Maybe there is a clue there. I was
wondering if you might have white letters on white background for some
weird reason?

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

Re: Problem with admin


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 to access the admin gui.

I keep getting this error below, but I don't understand it because I
did not edit the admin template files? Am I handling the admin
wrongly? What is the norm for handling multiple apps in the admin?

TemplateSyntaxError at /admin/
Caught IndentationError while rendering: unindent does not match any
outer indentation level (views.py, line 25)

Why do you think this has anything to do with template files? The error is quite specific: you have an indentation error in views.py, at or before line 25. Go and have a look at that file.
--
DR.

--
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/-/0caiDsL4sAIJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

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

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 registration url for member to register.

On Tue, Jan 31, 2012 at 7:34 PM, Dennis Lee Bieber
<wlfraed@ix.netcom.com> wrote:
> On Tue, 31 Jan 2012 07:43:53 -0800 (PST), richard
> <pullenjenna10@gmail.com> wrote:
>
>>to have my index view contain the registration form from django the
>>registration app so when the user visits the index page the
>>registration form is rendered there and when they submit the form it
>>goes back to the index page if there are any form errors.
>>
>        So ANYTIME anyone visits your root site (since that is what
> "index.html" normally represents) they are going to have a registration
> page inflicted upon them? What if they registered yesterday, shut down
> their computer, and come back next week -- do they have to go through
> your registration form again?
>
>        If your intent is that one must either be "logged in" before seeing
> this "index page", then I'd think /any/ access that doesn't have a
> "logged in" session cookie should redirect to a "log in" page -- and
> this log-in page should have a link to a registration page for new users
> to fill out (obviously both the "log in" and the registration pages must
> NOT require a "logged in" cookie status).
>
>        Whether you return the "log in" page or the "index page" then
> becomes a matter of having a valid session cookie in the request.
>
> CAVEAT: this is my conceptual view; implementation is not in my purview
> --
>        Wulfraed                 Dennis Lee Bieber         AF6VN
>        wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.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-users@googlegroups.com.
> To unsubscribe from this group, send email to django-users+unsubscribe@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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Problem with admin

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 understand it because I
did not edit the admin template files? Am I handling the admin
wrongly? What is the norm for handling multiple apps in the admin?

TemplateSyntaxError at /admin/
Caught IndentationError while rendering: unindent does not match any
outer indentation level (views.py, line 25)
Request Method: GET
Request URL: http://localhost:8000/admin/
Django Version: 1.3
Exception Type: TemplateSyntaxError
Exception Value:
Caught IndentationError while rendering: unindent does not match any
outer indentation level (views.py, line 25)
Exception Location: /Library/Frameworks/Python.framework/Versions/2.7/
lib/python2.7/site-packages/django/utils/importlib.py in
import_module, line 35
Python Executable: /Library/Frameworks/Python.framework/Versions/2.7/
Resources/Python.app/Contents/MacOS/Python
Python Version: 2.7.1
Python Path:
['/Users/max/Documents/Python/djproj3',
'/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-
packages/setuptools-0.6c11-py2.7.egg',
'/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-
packages/MySQL_python-1.2.3-py2.7-macosx-10.6-x86_64.egg',
'/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip',
'/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7',
'/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-
darwin',
'/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-
mac',
'/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-
mac/lib-scriptpackages',
'/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-
tk',
'/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-
old',
'/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-
dynload',
'/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-
packages',
'/Library/Python/2.7/site-packages']
Server time: Wed, 1 Feb 2012 03:50:29 +0800
Template error

In template /Library/Frameworks/Python.framework/Versions/2.7/lib/
python2.7/site-packages/django/contrib/admin/templates/admin/
base.html, error at line 31
Caught IndentationError while rendering: unindent does not match any
outer indentation level (views.py, line 25)

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

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

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 there was a standard CPython? Any help about my interpreter for Python on Ubuntu would be helpful.

As for Django I think I'm in good shape since it is now ready to go along side Ubuntu. And that's how i would move to production, on a Linux machine for it. I can open a python interpreter from the terminal but I thought I should have more than that such as IronPython or CPython?

JJ


There isn't such a thing as "CPython" that's separate from the Python interpreter already on your VM. That interpreter *is* CPython. You have no need to install anything else. In any case, that's the version that works with the other Python tools on the system, so installing a different one would be complicated and unnecessary.
--
DR.

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

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

On Tue, 31 Jan 2012 07:43:53 -0800 (PST), richard
<pullenjenna10@gmail.com> wrote:

>to have my index view contain the registration form from django the
>registration app so when the user visits the index page the
>registration form is rendered there and when they submit the form it
>goes back to the index page if there are any form errors.
>
So ANYTIME anyone visits your root site (since that is what
"index.html" normally represents) they are going to have a registration
page inflicted upon them? What if they registered yesterday, shut down
their computer, and come back next week -- do they have to go through
your registration form again?

If your intent is that one must either be "logged in" before seeing
this "index page", then I'd think /any/ access that doesn't have a
"logged in" session cookie should redirect to a "log in" page -- and
this log-in page should have a link to a registration page for new users
to fill out (obviously both the "log in" and the registration pages must
NOT require a "logged in" cookie status).

Whether you return the "log in" page or the "index page" then
becomes a matter of having a valid session cookie in the request.

CAVEAT: this is my conceptual view; implementation is not in my purview
--
Wulfraed Dennis Lee Bieber AF6VN
wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.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-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

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

On Tue, 31 Jan 2012 17:02:43 +0100, Alessandro Candini <candini@meeo.it>
wrote:

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

This sounds more like a need for shapefile translators (codecs, if
you will)... On input you'd convert the contents into a common database
format; reverse the process on output.

IOWs, my view is that you should be storing the "shape" and not the
"file".
--
Wulfraed Dennis Lee Bieber AF6VN
wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.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-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

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

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 attribute(s): using

what am I missing here??

any pointers or docs will be of great help.

-------------
Regards
Subhodip Biswas


GPG key : FAEA34AB
Server : pgp.mit.edu
http://subhodipbiswas.wordpress.com
http:/www.fedoraproject.org/wiki/SubhodipBiswas

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

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

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 Ubuntu would be helpful.

As for Django I think I'm in good shape since it is now ready to go along side Ubuntu. And that's how i would move to production, on a Linux machine for it. I can open a python interpreter from the terminal but I thought I should have more than that such as IronPython or CPython?

JJ


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

django-private-views

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_required.
(And a few other useful bits and pieces.)

Hope it's useful.  Let me know if there's any problems.

Cheers,

  Tom

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

Re: online transactions with python

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://groups.google.com/d/msg/django-users/-/bZO5GTdC9C0J.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: Question regarding ticket #17062

> 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 for you.
> So, for example for me the above would look:
> ALTER USER "akaariai" SET TIME ZONE 'Europe/Helsinki';
>
> The per-user settings are a really nice feature. Many problems in
> PostgreSQL can be neatly solved by usage of the per-user settings.
>
> You can verity that the change took place by reconnecting (the per
> user settings are only changed on connect), and running:
> select current_setting('timezone');
>
> The effect of this is that the rollback will still reset you timezone,
> but as the default is UTC there is nothing to worry :) In fact, once
> 1.4 is out, it will no longer run SET TIME ZONE at all, as 1.4 is able
> to recognize that the time zone is already correct for the connection!

Thank you very much, that's perfect.
--
Ashe

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

Re: Django Caching appended character issue

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 <ustunozgur@gmail.com> wrote:

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

Re: field name hiding workaround

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(Language)
>
> # ...
>
>I would like to have different types of lexemes, each of which has
>another field type as "entity". Like so:
>
>
>class CommodityLexeme(Lexeme):
>
> class Meta:
> verbose_name_plural = "Commodities"
>
> entity = models.ForeignKey(Commodity)
>
>
>class CountryLexeme(Lexeme):
>
> class Meta:
> verbose_name_plural = "Countries"
>
> entity = models.ForeignKey(Country)
>
>
>I know this doesn't work, because field name hiding is not permitted.
>(See https://docs.djangoproject.com/en/1.1/topics/db/models/#field-name-hiding-is-not-permitted).

You have not hidden any field names (note that the restriction
only applies to fields inherited from models.Model, not other
attributes, like the Meta class).

>But what would be the most elegant workaround? I suppose someone has
>had a similar problem before.

I think you can just move the "unique_together" into the Meta
classes for your Lexeme subclasses, and it should work as you
expect.

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

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

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 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 Alessandro Candini<candini@meeo.it>:
>> 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 update dynamically my models.py with a new
>> model and add a table for every shape inserted by the user, without using
>> syncdb.
>>
>> Trying to document myself about this topic, I encountered a lot of
>> interesting extensions like south, django-eav and django-mutant for example.
>> (An interesting discussion here:
>> http://stackoverflow.com/questions/7933596/django-dynamic-model-fields/7934577#7934577)
>>
>> But I'm very confused about what could be the best solution for my needs.
>>
>> Has anybody experience with this kind of tools?
>>
>> Thanks in advance.
>>
>> Alessandro
>>
>> --
>> 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+unsubscribe@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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

field name hiding workaround

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
another field type as "entity". Like so:


class CommodityLexeme(Lexeme):

class Meta:
verbose_name_plural = "Commodities"

entity = models.ForeignKey(Commodity)


class CountryLexeme(Lexeme):

class Meta:
verbose_name_plural = "Countries"

entity = models.ForeignKey(Country)


I know this doesn't work, because field name hiding is not permitted.
(See https://docs.djangoproject.com/en/1.1/topics/db/models/#field-name-hiding-is-not-permitted).

But what would be the most elegant workaround? I suppose someone has
had a similar problem before.

Jaroslav

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

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

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 Alessandro Candini <candini@meeo.it>:
> 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 update dynamically my models.py with a new
> model and add a table for every shape inserted by the user, without using
> syncdb.
>
> Trying to document myself about this topic, I encountered a lot of
> interesting extensions like south, django-eav and django-mutant for example.
> (An interesting discussion here:
> http://stackoverflow.com/questions/7933596/django-dynamic-model-fields/7934577#7934577)
>
> But I'm very confused about what could be the best solution for my needs.
>
> Has anybody experience with this kind of tools?
>
> Thanks in advance.
>
> Alessandro
>
> --
> 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+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

--
Andrés Reyes Monge
armonge@gmail.com
+(505)-8873-7217

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

Help using index view to render registration form from registration app

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 user visits the index page the
registration form is rendered there and when they submit the form it
goes back to the index page if there are any form errors.

Is it better to just make the registration app views render to my
index template instead but i wouldnt think this is a clean way. any
advice 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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: ANN: OGC Web Feature Service for GeoDjango

Wow! Congratulations on this release.

I'm looking at it right now.

:D

On Tue, Jan 31, 2012 at 1:11 PM, Jeff Heard <jefferson.r.heard@gmail.com> wrote:
https://github.com/JeffHeard/ga_ows

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 make it similar to my more recently implemented WFS.  This package is a reusable app that will allow you to expose any GeoDjango model as a Web Feature Service.  

Supported formats for output are currently anything that is supported by a single-file format in OGR.  Shapefiles are not yet supported for output but will be soon.  

Also, you can adapt WFS to any python object (including other ORMs) by deriving from WFSAdapter.  

-- Jeff


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



--
George R. C. Silva

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

Dynamic runtime modeling: which is the best choice?

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 update dynamically my models.py with a new
model and add a table for every shape inserted by the user, without
using syncdb.

Trying to document myself about this topic, I encountered a lot of
interesting extensions like south, django-eav and django-mutant for example.
(An interesting discussion here:
http://stackoverflow.com/questions/7933596/django-dynamic-model-fields/7934577#7934577)

But I'm very confused about what could be the best solution for my needs.

Has anybody experience with this kind of tools?

Thanks in advance.

Alessandro

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

ANN: OGC Web Feature Service for GeoDjango

https://github.com/JeffHeard/ga_ows

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 make it similar to my more recently implemented WFS.  This package is a reusable app that will allow you to expose any GeoDjango model as a Web Feature Service.  

Supported formats for output are currently anything that is supported by a single-file format in OGR.  Shapefiles are not yet supported for output but will be soon.  

Also, you can adapt WFS to any python object (including other ORMs) by deriving from WFSAdapter.  

-- Jeff


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

Re: online transactions with python

On Tue, Jan 31, 2012 at 5:43 AM, jj_Diego <ciegovr@gmail.com> 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 something or can help me... please send me an email.
>

Hi, I know about this 3 posible solutions:

• django-paypal[1] , which is a pluggable application that implements PayPal
Payments Standard and Payments Pro.

• django-authorizenet[2] , which implements Django integration with Autho-
rize.NET payment gateway. Includes SIM and AIM implementations

• Satchmo[3] payment application. Satchmo is an ecommerce framework
built on the Django framework, it includes a payment application with
support for several different payment modules including Authorize.net,
TrustCommerce, CyberSource, PayPal, Google Checkout, Sage Pay (For-
merly Protx) and Sermepa.

[1] http://github.com/johnboxall/django-paypal
[2] http://github.com/zen4ever/django-authorizenet
[3] http://www.satchmoproject.com

--
Marc

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

Re: Django Caching appended character issue

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

Re: Displaying template location in html

+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 Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/2UyWy8MPMjQJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: Displaying template location in html

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 <donarb@gmail.com> wrote:
> Use the Django Debug Toolbar, it shows all kinds of things. For
> templates, it shows the names of all the templates that make up the
> given page as well as which tags are used on the page.
>
> With DDT, you don't have to annotate (and un-annotate) anything.
>
> http://pypi.python.org/pypi/django-debug-toolbar
>
> On Jan 28, 10:26 pm, Alec Taylor <alec.tayl...@gmail.com> wrote:
>> With 40+ HTML files it's easy to get confused as to where each
>> component comes from.
>>
>> I don't want to annotate each file with its relative path manually, as
>> this will prove cumbersome when the site finally goes production.
>>
>> Is there a trick to displaying the template location on-screen?
>>
>> Thanks for all suggestions,
>>
>> Alec Taylor
>
> --
> 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+unsubscribe@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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Django and Zinnia blogpost

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

Monday, January 30, 2012

Re: Starting a new Python blog

@Aaron, good suggestion, I'll definitely look into it for a future
update, if only Twitter supported RSS feeds.

@Kate, yes I have considered changing the style of the site. I had no
idea the template would be so awkward when I first tested it. Now
that there's content, the styling really hurts navigation and overall
usability.

@Wc, I will make the change to open bookmarks in a new window/tab.
There is also the live bookmark feature available for Desktop browser
users, should work in all major browsers.

Kevin

On Jan 30, 7:47 am, Katie Cunningham <katie.ful...@gmail.com> wrote:
> Have you considered changing the styling of your site? It's a bit
> awkward to look at, since it looks like it was only made to fit on a
> much smaller screen. Perhaps you could look at Bootstrap, which is a
> much more flexible CSS framework?
>
> Katie
>
> On Mon, Jan 30, 2012 at 8:45 AM, Aaron Cannon
>
>
>
>
>
>
>
> <cann...@fireantproductions.com> wrote:
> > For me, Twitter is the new RSS.  Any chance of setting up a feed for
> > new content notifications?
>
> > Thanks.
>
> > Aaron
>
> > On 1/30/12, Kevin <kveron...@gmail.com> wrote:
> >> It is good to see some subscribers this early on.  Thank you.  I have
> >> rolled out the updates for Tutorials and set the foundation for the
> >> Review system by starting a list of packages I frequently use, and
> >> hope to later review.  I hope to have the full review system live by
> >> the end of this week.
>
> >> The tutorials will also use the package list I built to build a list
> >> of dependencies required for the tutorial itself.  I hope this makes
> >> it much easier to follow tutorials by knowing which Python packages
> >> will be required before hand.  The package list has a summary of the
> >> package and a link to the website where it is maintained.  There are
> >> currently 2 tutorials available for consumption.  Both are videos I
> >> made on YouTube for Rackspace Cloud last year, so if your curious
> >> about how Rackspace cloud works, do check them out.
>
> >> There is a separate RSS feed for the tutorials:
> >>http://www.pythondiary.com/tutorials.xml
>
> >> I am planning on making a "Digest" RSS Feed which will contain the
> >> latest posts from each section, but will also keep the separate feeds
> >> there for subscribers who only want the blog, or just tutorials.
>
> >> The site will remain ad-free for the time being, so that requests are
> >> quick for end-users.  I made use of the Django caching framework to
> >> also increase the response time.  I hope to keep the blog site quick
> >> and clean.
>
> >> Enjoy!
>
> >> On Jan 29, 5:06 pm, Mario Gudelj <mario.gud...@gmail.com> wrote:
> >>> Same :)
>
> >>> On 29 January 2012 19:11, Anler Hernandez Peral <anle...@gmail.com> wrote:
>
> >>> > you have one subscriber over here and waiting to see more posts ;)
>
> >>> > --
> >>> > anler
>
> >>> > On Sat, Jan 28, 2012 at 9:35 PM, Kevin <kveron...@gmail.com> wrote:
>
> >>> >> Hello Everyone,
>
> >>> >>  For sometime now I have been itching to create a Python blog, and
> >>> >> now the fruits of my labor have paid off.  I am ready to release the
> >>> >> blog to the public eyes.  At the moment it has 2 main features, a blog
> >>> >> portion, and a bookmark system.  Both the blog and the bookmark system
> >>> >> offer an RSS Atom feed.  The bookmark system is fully compatible with
> >>> >> "Live Bookmarks" to quickly access some of my top Python sites I visit
> >>> >> or visited recently which caught my eye.
>
> >>> >>  The website is called "Python Diary", a rather unique take on a tech
> >>> >> blog name.  The site itself has a diary-like theme, and is for the
> >>> >> most part very easily to navigate.  The website was completely built
> >>> >> using Python, the theme was taken from a wordpress theme website and
> >>> >> formatted to work with the Django template system.  The entire backend
> >>> >> is written from scratch using a few reusable Django apps, namely,
> >>> >> django-tagging, south, and cumulus.
>
> >>> >>  Now you might be saying, "Oh great, yet another Python blog".  But
> >>> >> wait...  I plan on setting this blog apart from the thousands of other
> >>> >> blogs in the world with some very unique features.  Features normally
> >>> >> found on commercial software blogs, movie and video game blogs is a
> >>> >> thorough review system.  I plan on going through many of the available
> >>> >> Python packages out there in the wild and basically reviewing them
> >>> >> like one would review anything else.  I do not see a dedicated Python
> >>> >> website which has reviews of many Python packages available in PyPi.
> >>> >> I plan on stating the usual pros and cons of the package, and
> >>> >> providing a score.  For example of how this type of review is
> >>> >> formatted, take a look at a CNET Review.
>
> >>> >> My new blog can be found here:http://www.pythondiary.com/
>
> >>> >>  Tell me what you think of the website in general, and the overall
> >>> >> idea for this blog.
>
> >>> >> If you would like to subscribe to the upcoming content, add this RSS
> >>> >> feed to your favorite RSS reader:
> >>> >>http://www.pythondiary.com/blog.xml
>
> >>> >> --
> >>> >> 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+unsubscribe@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+unsubscribe@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+unsubscribe@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+unsubscribe@googlegroups.com.
> > For more options, visit this group athttp://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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.