Re: Django can't see my static files

2011-08-02 Thread Thomas Orozco
Last thing, I made a typo, the address you could use should start with http, like: http://127.0.0.1/static/ Le 2 août 2011 12:01, "Thomas Orozco" a écrit : > A little detail, but you never know: you should put some ' ' in your link. > Like this : > > > > &g

Django raises IOerror in csrf.py middleware

2011-08-02 Thread Thomas Orozco
Hello, I received a traceback from Django and I'm unable to figure out where the error comes from. The form is a basic picture upload form, I've read that this kind of errors do happen when the connection is broken before all data was sent, but here, the crash occured in csrf.py, which it was not

Re: HttpRequest.META['SERVER_PORT'] is a string?

2011-08-02 Thread Thomas Orozco
Basically everything (ok, almost) in request.META is strings, so I guess it would be pretty consistent if for some reason server port wasn't. It's usually your job to normalize data that comes into your application anyways. Le 2 août 2011 23:04, "Roy Smith" a écrit : > I'm running django 1.3. If

Re: if condition in template not working

2011-08-06 Thread Thomas Orozco
In your context you passed your 'lists' object as 'book'. So {% if book %} would work, but your current syntax won't. Le 6 août 2011 19:32, "shakthi" a écrit : > The if condition in my html template is not working, only else is > executing. > > view function is > def test(request): > lists=Book.o

Re: sendmail question

2011-08-08 Thread Thomas Orozco
Open works files that are on your hard drive, not with urls. That is : open('/var/www/myfile') works, but open('http://mysite/myfile') doesn't. You should not use the url of the file but its location on the disk (like /var/mymedia/myfile on Linux). If you really want to open it through the inter

Re: Passing tuple values to a model choices field

2011-08-08 Thread Thomas Orozco
Check out get_FOO_display, there: https://docs.djangoproject.com/en/dev/ref/models/instances/ Le 8 août 2011 11:06, "Kayode Odeyemi" a écrit : > In the Django [1], the example as described below shows how to build Forms > that are tied to a model. > > from django.db import models > from django.for

Re: Passing tuple values to a model choices field

2011-08-08 Thread Thomas Orozco
to do. What I got stuck with is that > the tuple values are not displayed as options in the form select > field(choices). > > Thanks > > On Mon, Aug 8, 2011 at 10:40 AM, Thomas Orozco wrote: > >> Check out get_FOO_display, there: >> https://docs.djangoproject

Re: Passing tuple values to a model choices field

2011-08-08 Thread Thomas Orozco
Like they do in the admin, right ? You might want to check Django's source for the admin forms and templates to get some inspiration then. Hard coding the choices is never a satisfactory solution but I suggest you retrieve them from your models file so you stay DRY compliant and then it's pretty

Re: Set order from admin

2011-08-10 Thread Thomas Orozco
You can use a single foreign key and store last changed in your B model. You can then use object_a.b_set.order_by('myTimeStamp') Le 10 août 2011 10:23, "Isaac" a écrit : -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, se

Re: "Great circle" using the django ORM?

2011-08-11 Thread Thomas Orozco
The distance is: Sqrt( Sqr(lat1-lat2) + Sqr(long1-long2) ) Le 11 août 2011 17:09, "Thomas Weholt" a écrit : > I got a model with longitude and latitude and want to be able to find > other objects nearby a selected object. Can this be done using the > django orm? What is the best approach to do thi

Re: "Great circle" using the django ORM?

2011-08-11 Thread Thomas Orozco
hu, Aug 11, 2011 at 12:43 PM, Thomas Orozco > wrote: >> The distance is: Sqrt( Sqr(lat1-lat2) + Sqr(long1-long2) ) >> >> Le 11 août 2011 17:09, "Thomas Weholt" a écrit : >>> I got a model with longitude and latitude and want to be able to find >>> oth

Re: "Great circle" using the django ORM?

2011-08-11 Thread Thomas Orozco
Thank you both for the details! Le 11 août 2011 23:04, "Gelonida N" a écrit : > On 08/11/2011 06:43 PM, Thomas Orozco wrote: >> The distance is: Sqrt( Sqr(lat1-lat2) + Sqr(long1-long2) ) > > Try the formula close to the poles and you notice that there is > something

Re: Defunct Processes on Server

2011-08-12 Thread Thomas Orozco
You could avoid starting the child process in your view. If it's a long running process I would actually advocate doing so. This might be due to limited understanding on my part, but what happens when Apache wants to kill its child process because MaxRequests was reached? If you don't need the jo

<    1   2