Re: Why doesn't a forms.fields.DateField always return a datetime.date instance?

2014-03-04 Thread Peter Bengtsson
On Tuesday, March 4, 2014 5:19:17 PM UTC-8, Tom Evans wrote: > > On Tue, Mar 4, 2014 at 10:45 PM, Peter Bengtsson > > > wrote: > > The link was to django master. So it's in all versions. > > > > Well, that doesn't necessarily follow does it? It could have been > changed recently in trunk, s

Re: django 1.6.1 raw_id_fields open a 'change' popup instead of 'select' popup

2014-03-04 Thread Camilo Torres
On Tuesday, March 4, 2014 4:47:58 AM UTC-4:30, Vittorio wrote: > > In an admin form I input all data for a specific invoice (client, date of > issue, number of invoice) and, by means of inlines, the ordered items. In > these inlines I defined a raw_id_fields referring to the 'items' model > whic

Re: Why doesn't a forms.fields.DateField always return a datetime.date instance?

2014-03-04 Thread Tom Evans
On Tue, Mar 4, 2014 at 10:45 PM, Peter Bengtsson wrote: > The link was to django master. So it's in all versions. > Well, that doesn't necessarily follow does it? It could have been changed recently in trunk, say for 1.6 release. If you were using 1.5 it could be different. I haven't looked back,

Re: URLValidator raising sre_constants.error

2014-03-04 Thread rectangletangle
I believe I may have found the issue. I was using the validator incorrectly. I was passing the string to `__init__` like so ` URLValidator('\\')`, instead of passing it to the `__call__` method like this `URLValidator()('\\')`. On Tuesday, March 4, 2014 4:13:12 PM UTC-8, rectang...@gmail.com wro

URLValidator raising sre_constants.error

2014-03-04 Thread rectangletangle
When entering two backslashes into the URL validator it raises an `sre_constants.error`. As per the docs, it seems like the validator should catch this and then chain a `ValidationError

Re: What to do after python manage.py runserver

2014-03-04 Thread Bill Freeman
Or you can share the one terminal by stopping the server to run other commands, then do runserver again to test them. The startup message should have told you how to stop (exit, kill) the server. On linux it's control-C. That may work elsewhere too. (Just for completeness, in an emacx shell win

Re: What to do after python manage.py runserver

2014-03-04 Thread Thomas Murphy
Hi Matthew, You'll want to leave the window you typed runserver in open so your app can print information about it's activities to that window. Open another terminal window and proceed from there. Happy Hacking! Thomas On Tue, Mar 4, 2014 at 4:50 PM, Matthew Epps wrote: > Hey all, > > I apol

What to do after python manage.py runserver

2014-03-04 Thread Matthew Epps
Hey all, I apologize for the extremely basic question. I am new to django and python. But after I enter the "python manage.py runserver" command, my terminal prints out the message that the tutorial says I should expect. However, I have a difficult time entering the other commands on the tutor

Re: Why doesn't a forms.fields.DateField always return a datetime.date instance?

2014-03-04 Thread Peter Bengtsson
On Tuesday, March 4, 2014 12:47:03 PM UTC-8, Tom Evans wrote: > > On Tue, Mar 4, 2014 at 8:27 PM, Peter Bengtsson > > > wrote: > > I've been googling for an explanation but nothing's come up. > > > > See > > https://github.com/django/django/blob/master/django/forms/fields.py#L447 > > > >

Admin interface is calling a custom method on my model?

2014-03-04 Thread Greg Barker
I have a model with a custom method like so: class MyModel(models.Model): some_counter_field = models.IntegerField(blank=True, default=0) def my_custom_method(self): if (self.some_counter_field < 5): self.some_counter_field += 1 self.save() retu

Re: confused about sql in django

2014-03-04 Thread Tom Evans
On Tue, Mar 4, 2014 at 8:08 PM, Robin Lery wrote: > Hello, > > I am really being confused. How to use sql in django? I found two: > 1. Performing raw queries. > 2.Executing custom SQL directly. > > Does it have better performance than the django's orm? And how is the > performance the same between

Re: Why doesn't a forms.fields.DateField always return a datetime.date instance?

2014-03-04 Thread Tom Evans
On Tue, Mar 4, 2014 at 8:27 PM, Peter Bengtsson wrote: > I've been googling for an explanation but nothing's come up. > > See > https://github.com/django/django/blob/master/django/forms/fields.py#L447 > > If you use a `DateField` in your form, don't you expect it to produce a > `datetime.date` ins

Re: Why doesn't a forms.fields.DateField always return a datetime.date instance?

2014-03-04 Thread Tom Evans
On Tue, Mar 4, 2014 at 8:27 PM, Peter Bengtsson wrote: > I've been googling for an explanation but nothing's come up. > > See > https://github.com/django/django/blob/master/django/forms/fields.py#L447 > > If you use a `DateField` in your form, don't you expect it to produce a > `datetime.date` ins

Re: confused about sql in django

2014-03-04 Thread Alex Mandel
On 03/04/2014 12:08 PM, Robin Lery wrote: > Hello, > > I am really being confused. How to use sql in django? I found two: > 1. Performing raw queries. > 2.Executing custom SQL directly. > Do you have links for those? I know there is a the raw query mode of Django, and I'm guessing the other metho

Why doesn't a forms.fields.DateField always return a datetime.date instance?

2014-03-04 Thread Peter Bengtsson
I've been googling for an explanation but nothing's come up. See https://github.com/django/django/blob/master/django/forms/fields.py#L447 If you use a `DateField` in your form, don't you expect it to produce a `datetime.date` instance? E.g. class MyForm: start = forms.DateField() def

confused about sql in django

2014-03-04 Thread Robin Lery
Hello, I am really being confused. How to use sql in django? I found two: 1. Performing raw queries. 2.Executing custom SQL directly. Does it have better performance than the django's orm? And how is the performance the same between those two? And lastly, what is sqlalchemy? Are sqlalchemy and d

Re: [ELI5] how to deploy django

2014-03-04 Thread voger
Hi, I am using Debian Wheezy and this is my configuration. This is the content of /etc/apache2/sites-available/mysitedomain.com. I made this file following the official django docs. Keep in mind that this is a deployed for testing purposes site so both static files and django files are served

Re: django and amazon web services

2014-03-04 Thread Robin Lery
Thank you Clifford for the heads up and your advice! On Sun, Mar 2, 2014 at 1:32 AM, CLIFFORD ILKAY wrote: > On 03/01/2014 11:21 AM, Robin Lery wrote: > > Very nicely explained! I was actually hoping to use Amazon RDS with > > postgresql. Your help was very useful. Thank you! > > There is anoth

Re: Trouble with Django in production server.

2014-03-04 Thread Tom Evans
On Tue, Mar 4, 2014 at 7:11 PM, Daniel Roseman wrote: > That's why, as everyone keeps telling you, you need > to activate the virtualenv in your server, which is normally done in the > wsgi file. Is it? I keep my wsgi.py exactly as startproject created it, I set python-path when setting WSGIDaemo

Re: Trouble with Django in production server.

2014-03-04 Thread Daniel Roseman
On Tuesday, 4 March 2014 00:54:48 UTC, Omar Acevedo wrote: > > Also there's a file called .bashrc which activates the virtualenv. > This is the line that does that: > source /home/userName/.env/env/bin/activate > So it runs (the virtualenv) always. > But the web server is not running as you! S

Re: [ELI5] how to deploy django

2014-03-04 Thread Daniel Roseman
On Tuesday, 4 March 2014 16:53:32 UTC, Walter Wang wrote: > > Thanks alot for all your answers, I really appreciate it. > > I am using ubuntu 12.04 lts hosted on digitalocean. Apache version is > 2.2.2 and django is 1.6, I created a virtualenv in the home directory, > named myproject, I am using

Re: [ELI5] how to deploy django

2014-03-04 Thread Walter Wang
Thanks alot for all your answers, I really appreciate it. I am using ubuntu 12.04 lts hosted on digitalocean. Apache version is 2.2.2 and django is 1.6, I created a virtualenv in the home directory, named myproject, I am using python3.2 as the interpreter in the virtualenv. All your answers ha

Re: Showing which users are viewing a given page

2014-03-04 Thread Manu
Hey Some Developer, If you have the option, try http://www.google.com/analytics/. There are other similar services to get the analytics about real time usage statistics about your website. If you want to identify each individual user, http://kissmetrics.com/ or https://mixpanel.com/ are also goo

Re: Showing which users are viewing a given page

2014-03-04 Thread Paul J Stevens
On 04-03-14 13:28, Some Developer wrote: > Hopefully someone here will be able to point me in the right direction. > > Basically I want to be able to view which users are viewing a page at > any given time and I want to be able to update it in real time using > JavaScript but I'm at a loss as to h

Re: [ELI5] how to deploy django

2014-03-04 Thread Alan Hicks
On 04/03/2014 03:36, Walter Wang wrote: I tried my best to follow the various guides out there, but the official documentation here https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/modwsgi/ has different instructions than the instructions here, https://www.digitalocean.com/community/

about csv import

2014-03-04 Thread Choro Hasu
hello: I could not import csv to SnetOS from local pc, please tell me this is my views.py file : def import_csv(request): upload_filename = 'csvfile' if request.method == 'POST' and request.FILES.has_key('upload_filename'): csv_file = request.FILES['csv_file']

Re: modification time in Python - Django

2014-03-04 Thread Paul J Stevens
On 02-03-14 20:49, Jaap van Wingerde wrote: > views.py: > ... > pwd = os.path.dirname(os.path.realpath(__file__ )) > home_lastmod = > strftime('%Y-%m-%dT%H:%m:%SZ',gmtime(os.path.getmtime(pwd+'/templates/art_index.html'))) > ... > > The template says: "2014-03-02T19:03:55Z". The strtime argumen

Re: Showing which users are viewing a given page

2014-03-04 Thread Dig
my opinion, frontend: setup a ping api, and refresh every 30 seconds, pass in a current page url from javascript, and return current page viewers. backup: a table has 3 main column (user id, page id, last_ping). update the page_id and last_ping when receiving a ping request. and return users list

Re: Showing which users are viewing a given page

2014-03-04 Thread Nevio Vesic
Well proper way of doing that in your case would be to use something like a socket.io and have each page as a separate channel. Than you can on user join/leave emit/push appropriate count. Other way would be to hook on middleware http request and than update or redis or database entry for that par

Showing which users are viewing a given page

2014-03-04 Thread Some Developer
Hopefully someone here will be able to point me in the right direction. Basically I want to be able to view which users are viewing a page at any given time and I want to be able to update it in real time using JavaScript but I'm at a loss as to how to track which users are viewing any given p

File uploads - a warning

2014-03-04 Thread André Cruz
Hello. If your application receives file uploads, and thus you have your frontend server configured to allow request bodies >= 10MB for example, you should pay attention to ticket #21231 (https://code.djangoproject.com/ticket/21231). Django enforces size limits on FILE parts, but does not do t

Re: [ELI5] how to deploy django

2014-03-04 Thread Daniel Roseman
On Tuesday, 4 March 2014 07:28:04 UTC, Sam Lai wrote: > > On 4 March 2014 14:36, Walter Wang > > wrote: > > I tried my best to follow the various guides out there, but the > official > > documentation here > > https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/modwsgi/has > > differ

django 1.6.1 raw_id_fields open a 'change' popup instead of 'select' popup

2014-03-04 Thread Vittorio
django==1.6.1 python==2.7.6 Mac OS X 10.7.5 (development) & UBUNTU Linux 13.04 (production -- Apache 2.2.server) Browsers==(Mac OS X) Safari, Firefox,Chrome; (Linux) Firefox To put in a nutshell in my app (I'm translating from Italian into English) 'warehouse' I have a model 'invoice' and a mo