Re: Connecting to a MS SQL server from django

2014-01-14 Thread Avraham Serour
I would try using some kind of DB explorer first, to make sure I have the
ip, port and auth right, once you are able using some other tool you can
just use the same settings in your code


On Wed, Jan 15, 2014 at 6:46 AM, Larry Martell wrote:

> On Tuesday, January 14, 2014, Mark Moss wrote:
>
>> The default port for MySQL is 3306. Have you tried that one?
>>
>
>
> I'm not trying to connect to MySQL - I'm trying to connect to Microsoft
> SQL server.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CACwCsY5qidVz3PcCxnCfSpJx134hL68cicMaZUCmRKRpLJ6%3DWQ%40mail.gmail.com
> .
>
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFWa6tKSNGb6PLenqH3h9FHxMpp%3De%2Bv_W686Aq71HnjsGL-%2B%2Bw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Connecting to a MS SQL server from django

2014-01-14 Thread Larry Martell
On Tuesday, January 14, 2014, Mark Moss wrote:

> The default port for MySQL is 3306. Have you tried that one?
>


I'm not trying to connect to MySQL - I'm trying to connect to Microsoft SQL
server.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACwCsY5qidVz3PcCxnCfSpJx134hL68cicMaZUCmRKRpLJ6%3DWQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Connecting to a MS SQL server from django

2014-01-14 Thread Alex Mandel
On 01/14/2014 03:15 PM, Larry Martell wrote:
> I am trying to connect to a MS SQL server from django on Linux using
> Vernon Cole's django-mssql package
> (https://bitbucket.org/vernondcole/django-mssql-ado-merge/src).
> 
> When I first tried to connect it failed with:
> 
> Exception Type: DatabaseError at /report/CDSEM/EventsTable/
> Exception Value: Cannot create connection
> to=PYRO:ado.connect...@xx.xx.xx.xx:9099
> 
> I traced it through
> /usr/lib/python2.6/site-packages/adodbapi/remote.py and I see it tries
> to access os.environ['PROXY_PORT'], which is not defined and then it
> defaults to 9099 - Is that the correct port or should I set
> os.environ['PROXY_PORT']? How can I tell what port MS SQL db is
> listening on? I googled this and it said the default MS SQL port is
> 1433. I set os.environ['PROXY_PORT'] to that and now I don't get that
> error but it times out:
> 
>> /usr/lib/python2.6/site-packages/Pyro4-4.22-py2.6.egg/Pyro4/core.py(160)__call__()
> -> return self.__send(self.__name, args, kwargs)
> (Pdb) n
> TimeoutError: TimeoutE...imeout',)
> 
> I tried opening port 1433 with iptables, but still no joy.
> 
> I can connect to the MS SQL db locally from the host it's running so I
> know it's up and my credentials are correct, and I can ping the
> Windows box from the Linux host I am running on, so I know there is
> connectivity to it from there.
> 
> Anyone here ever get this working? Anyone have any ideas as to what my
> problem is or how I can debug this further?
> 
> Thanks!
> -larry
> 

Check your Windows Firewall settings. You can test from linux using nmap
to port probe.
nmap -PN -p 1433 ip.of.win.machine

It is unlikely to be the linux firewall unless you're filtering all
outgoing data.

Enjoy,
Alex

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/52D608E5.4050100%40wildintellect.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Connecting to a MS SQL server from django

2014-01-14 Thread Mark Moss
The default port for MySQL is 3306. Have you tried that one?

--
- Mark
*Try this new Instant Django Hosting 
*

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d1e9d0b2-8706-4eba-95fb-50a1263dfdc3%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: text media files for comments

2014-01-14 Thread Sven Aßmann
Hi Fatih,

i would ask myself the question is this static data that not changes 
frequently or is it editable content that should be:

a) maintainable from users (without code updates of course)
b) is maintained independently form software releaes

if one of thoses questions can be answered with yes then i would go for a 
model that stores that texts. So that in fact you only render that stuff within 
a normal view (like blog posts but much more simpler)

if the answer is no: then just include it like css of js files and deliver the 
files with a custom ResponseView that reads the file content and puts it out, 
or 
a specialized template view that skips the parse and processing aspect of 
processing templates.

On Monday 13 January 2014 13:11:55 Fatih Tiryakioglu wrote:
> Hi all,
> 
> I want to render a static media .txt file from django template, but I can't
> load it. Should I use database for text comments, or is it better statatic
> text files like image files in media folder.
> 
> Any help is appreciated.
-- 


Best Regards, 
Sven

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1711781.vXMkOL7t90%40gilgamesch.
For more options, visit https://groups.google.com/groups/opt_out.


mass email app for django

2014-01-14 Thread Sven Aßmann
Hi Group,

currently i evaluating / research for a django app that supports mailing 
specific texts to a receipient list (like mass emailing). the corner features 
are:

- email text should be editable (text or html nothing special) thru the admin 
app
- the receipient list should be maintainable independently from users and 
texts (like a addressbook that is maintanale thru admin app)
- ideally supports several mail backends like smtp, aws sms, postmark etc..
- processing of the sending can be done async via django cli / message queue 
services 

The closest use case app would be something like a newsletter app, where the 
subscibers can be maintainted apart from django.auth.users
I am aware of www.djangopackages.com and found already a couple of 
applications that could make the job.

I ask you folks if someone has good experience with a specific one and or what 
features are included and helpfull and what are not that helpfull. 

I really appreciate your contributions.

-- 


Best Regards, 
Sven

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3688706.24zruyElKd%40gilgamesch.
For more options, visit https://groups.google.com/groups/opt_out.


Connecting to a MS SQL server from django

2014-01-14 Thread Larry Martell
I am trying to connect to a MS SQL server from django on Linux using
Vernon Cole's django-mssql package
(https://bitbucket.org/vernondcole/django-mssql-ado-merge/src).

When I first tried to connect it failed with:

Exception Type: DatabaseError at /report/CDSEM/EventsTable/
Exception Value: Cannot create connection
to=PYRO:ado.connect...@xx.xx.xx.xx:9099

I traced it through
/usr/lib/python2.6/site-packages/adodbapi/remote.py and I see it tries
to access os.environ['PROXY_PORT'], which is not defined and then it
defaults to 9099 - Is that the correct port or should I set
os.environ['PROXY_PORT']? How can I tell what port MS SQL db is
listening on? I googled this and it said the default MS SQL port is
1433. I set os.environ['PROXY_PORT'] to that and now I don't get that
error but it times out:

> /usr/lib/python2.6/site-packages/Pyro4-4.22-py2.6.egg/Pyro4/core.py(160)__call__()
-> return self.__send(self.__name, args, kwargs)
(Pdb) n
TimeoutError: TimeoutE...imeout',)

I tried opening port 1433 with iptables, but still no joy.

I can connect to the MS SQL db locally from the host it's running so I
know it's up and my credentials are correct, and I can ping the
Windows box from the Linux host I am running on, so I know there is
connectivity to it from there.

Anyone here ever get this working? Anyone have any ideas as to what my
problem is or how I can debug this further?

Thanks!
-larry

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACwCsY4%3DSk4yCE4gqSLig6KfWjbxg45Rap2VSJNwkLn%2BZFWSbw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: saving to two models from one class view

2014-01-14 Thread Dan Gentry
With a formset, like your application form, the template could look like 
one of these examples:


{{ formset.management_form }}

{% for form in formset %}
{{ form }}
{% endfor %}




{{ formset }}


(found on 
https://docs.djangoproject.com/en/dev/topics/forms/formsets/#using-a-formset-in-views-and-templates
)

I'm not sure if this will do everything you want, but will get you past the 
current error.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/cb43caf3-781f-4d41-9b4b-0fba73148b91%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Encoding UTF 8 (añ,etc) and datetime function

2014-01-14 Thread Sergio Garcia
Basically a "# coding=utf-8" at begining of your file and saving it with
utf-8 will solve your problem.


On Tue, Jan 14, 2014 at 4:58 PM, Sergio Garcia  wrote:

> I had the some problem (Português tem seus acentos :) )
>
>
> From the Python reference:
>
> http://www.python.org/dev/peps/pep-0263/
>
> Python will default to ASCII as standard encoding if no other
> encoding hints are given.
>
> To define a source code encoding, a magic comment must
> be placed into the source files either as first or second
> line in the file, such as:
>
>   # coding=
>
> or (using formats recognized by popular editors)
>
>   #!/usr/bin/python
>   # -*- coding:  -*-
>
> or
>
>   #!/usr/bin/python
>   # vim: set fileencoding= :
>
>
>
>
>
> On Tue, Jan 14, 2014 at 4:12 PM, David Pineda  wrote:
>
>> The code:
>>
>> from django.http import Http404, HttpResponse
>> import datetime
>> # coding: utf-8
>>
>> def hello(request):
>> return HttpResponse("Hello world")
>> def home_page(request):
>> return HttpResponse("Página de Inicio")
>> def current_datetime(request):
>> now = datetime.datetime.now()
>> html = "It is now %s." % now
>> return HttpResponse(html)
>> def hours_ahead(request, offset):
>> try:
>> offset = int(offset)
>> except ValueError:
>> raise Http404()
>> dt = datetime.datetime.now() + datetime.timedelta(hours=offset)
>> html = "In %s hour(s), it will be %s." %
>> (offset, dt)
>> return HttpResponse(html)
>>
>> Whit utf8
>>
>> SyntaxError at /time/plus/99/
>>
>> Non-ASCII character '\xc3' in file 
>> /home/david/Documents/Django/tutorial2/base1/base1/views.py on line 8, but 
>> no encoding declared; see http://www.python.org/peps/pep-0263.html for 
>> details (views.py, line 8)
>>
>>  Request Method: GET  Request URL: http://127.0.0.1:8000/time/plus/99/  
>> Django
>> Version: 1.5.5  Exception Type: SyntaxError  Exception Value:
>>
>> Non-ASCII character '\xc3' in file 
>> /home/david/Documents/Django/tutorial2/base1/base1/views.py on line 8, but 
>> no encoding declared; see http://www.python.org/peps/pep-0263.html for 
>> details (views.py, line 8)
>>
>>   Exception Location: 
>> /home/david/Documents/Django/tutorial2/base1/base1/urls.py
>> in , line 2  Python Executable: /usr/bin/python  Python Version:
>> 2.7.5  Python Path:
>>
>> ['/home/david/Documents/Django/tutorial2/base1',
>>  '/usr/lib/python27.zip',
>>  '/usr/lib64/python2.7',
>>  '/usr/lib64/python2.7/plat-linux2',
>>  '/usr/lib64/python2.7/lib-tk',
>>  '/usr/lib64/python2.7/lib-old',
>>  '/usr/lib64/python2.7/lib-dynload',
>>  '/usr/lib64/python2.7/site-packages',
>>  '/usr/lib64/python2.7/site-packages/PIL',
>>  '/usr/local/lib64/python2.7/site-packages',
>>  '/usr/local/lib/python2.7/site-packages',
>>  '/usr/lib64/python2.7/site-packages/gtk-2.0',
>>  '/usr/lib/python2.7/site-packages',
>>  '/usr/lib64/python2.7/site-packages/wx-2.8-gtk2-unicode']
>>
>>  Server time: Tue, 14 Jan 2014 12:12:55 -0600
>> The code whituot 'á'-->a
>>
>> from django.http import Http404, HttpResponse
>> import datetime
>> # coding: utf-8
>>
>> def hello(request):
>> return HttpResponse("Hello world")
>> def home_page(request):
>> return HttpResponse("Pagina de Inicio")
>> ..
>> .
>> .
>> It's work
>>
>>
>>
>> El martes, 14 de enero de 2014 13:21:20 UTC-3, Erik Cederstrand escribió:
>>>
>>> Den 14/01/2014 kl. 17.04 skrev David Pineda :
>>>
>>> > Hello, i'm beginning to learn python+django and i'm doing that
>>> handbook https://github.com/jacobian/djangobook.com/blob/master/
>>> chapter03.rst
>>> > In the example whit datetime i have a problem when i active the utf-8
>>> encondig because i use á,ñ, etc (i'm chilean and we talk in spanish)
>>> > So, when i deactive it's works fine, but in the future when i do
>>> something more i will need the utf8 enconding and all functionalities like
>>> datetime working and i don't know  yet how to do to make work together
>>> that,
>>>
>>> Please post the code where you are trying to use non-ASCII characters.
>>> What did you try, and what is the exact error message you see?
>>>
>>> Thanks,
>>> Erik
>>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/67d88b83-2be9-4295-93f5-c285f760736c%40googlegroups.com
>> .
>>
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop 

Re: Encoding UTF 8 (añ,etc) and datetime function

2014-01-14 Thread Sergio Garcia
I had the some problem (Português tem seus acentos :) )


>From the Python reference:

http://www.python.org/dev/peps/pep-0263/

Python will default to ASCII as standard encoding if no other
encoding hints are given.

To define a source code encoding, a magic comment must
be placed into the source files either as first or second
line in the file, such as:

  # coding=

or (using formats recognized by popular editors)

  #!/usr/bin/python
  # -*- coding:  -*-

or

  #!/usr/bin/python
  # vim: set fileencoding= :





On Tue, Jan 14, 2014 at 4:12 PM, David Pineda  wrote:

> The code:
>
> from django.http import Http404, HttpResponse
> import datetime
> # coding: utf-8
>
> def hello(request):
> return HttpResponse("Hello world")
> def home_page(request):
> return HttpResponse("Página de Inicio")
> def current_datetime(request):
> now = datetime.datetime.now()
> html = "It is now %s." % now
> return HttpResponse(html)
> def hours_ahead(request, offset):
> try:
> offset = int(offset)
> except ValueError:
> raise Http404()
> dt = datetime.datetime.now() + datetime.timedelta(hours=offset)
> html = "In %s hour(s), it will be %s." %
> (offset, dt)
> return HttpResponse(html)
>
> Whit utf8
>
> SyntaxError at /time/plus/99/
>
> Non-ASCII character '\xc3' in file 
> /home/david/Documents/Django/tutorial2/base1/base1/views.py on line 8, but no 
> encoding declared; see http://www.python.org/peps/pep-0263.html for details 
> (views.py, line 8)
>
>  Request Method: GET  Request URL: http://127.0.0.1:8000/time/plus/99/  Django
> Version: 1.5.5  Exception Type: SyntaxError  Exception Value:
>
> Non-ASCII character '\xc3' in file 
> /home/david/Documents/Django/tutorial2/base1/base1/views.py on line 8, but no 
> encoding declared; see http://www.python.org/peps/pep-0263.html for details 
> (views.py, line 8)
>
>  Exception Location: 
> /home/david/Documents/Django/tutorial2/base1/base1/urls.py
> in , line 2  Python Executable: /usr/bin/python  Python Version:
> 2.7.5  Python Path:
>
> ['/home/david/Documents/Django/tutorial2/base1',
>  '/usr/lib/python27.zip',
>  '/usr/lib64/python2.7',
>  '/usr/lib64/python2.7/plat-linux2',
>  '/usr/lib64/python2.7/lib-tk',
>  '/usr/lib64/python2.7/lib-old',
>  '/usr/lib64/python2.7/lib-dynload',
>  '/usr/lib64/python2.7/site-packages',
>  '/usr/lib64/python2.7/site-packages/PIL',
>  '/usr/local/lib64/python2.7/site-packages',
>  '/usr/local/lib/python2.7/site-packages',
>  '/usr/lib64/python2.7/site-packages/gtk-2.0',
>  '/usr/lib/python2.7/site-packages',
>  '/usr/lib64/python2.7/site-packages/wx-2.8-gtk2-unicode']
>
>  Server time: Tue, 14 Jan 2014 12:12:55 -0600
> The code whituot 'á'-->a
>
> from django.http import Http404, HttpResponse
> import datetime
> # coding: utf-8
>
> def hello(request):
> return HttpResponse("Hello world")
> def home_page(request):
> return HttpResponse("Pagina de Inicio")
> ..
> .
> .
> It's work
>
>
>
> El martes, 14 de enero de 2014 13:21:20 UTC-3, Erik Cederstrand escribió:
>>
>> Den 14/01/2014 kl. 17.04 skrev David Pineda :
>>
>> > Hello, i'm beginning to learn python+django and i'm doing that handbook
>> https://github.com/jacobian/djangobook.com/blob/master/chapter03.rst
>> > In the example whit datetime i have a problem when i active the utf-8
>> encondig because i use á,ñ, etc (i'm chilean and we talk in spanish)
>> > So, when i deactive it's works fine, but in the future when i do
>> something more i will need the utf8 enconding and all functionalities like
>> datetime working and i don't know  yet how to do to make work together
>> that,
>>
>> Please post the code where you are trying to use non-ASCII characters.
>> What did you try, and what is the exact error message you see?
>>
>> Thanks,
>> Erik
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/67d88b83-2be9-4295-93f5-c285f760736c%40googlegroups.com
> .
>
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 

Re: Encoding UTF 8 (añ,etc) and datetime function

2014-01-14 Thread David Pineda
The code:

from django.http import Http404, HttpResponse
import datetime
# coding: utf-8

def hello(request):
return HttpResponse("Hello world")
def home_page(request):
return HttpResponse("Página de Inicio")
def current_datetime(request):
now = datetime.datetime.now()
html = "It is now %s." % now
return HttpResponse(html)
def hours_ahead(request, offset):
try:
offset = int(offset)
except ValueError:
raise Http404()
dt = datetime.datetime.now() + datetime.timedelta(hours=offset)
html = "In %s hour(s), it will be %s." % 
(offset, dt)
return HttpResponse(html)

Whit utf8

SyntaxError at /time/plus/99/ 

Non-ASCII character '\xc3' in file 
/home/david/Documents/Django/tutorial2/base1/base1/views.py on line 8, but no 
encoding declared; see http://www.python.org/peps/pep-0263.html for details 
(views.py, line 8)

 Request Method: GET  Request URL: http://127.0.0.1:8000/time/plus/99/  Django 
Version: 1.5.5  Exception Type: SyntaxError  Exception Value: 

Non-ASCII character '\xc3' in file 
/home/david/Documents/Django/tutorial2/base1/base1/views.py on line 8, but no 
encoding declared; see http://www.python.org/peps/pep-0263.html for details 
(views.py, line 8)

 Exception Location: /home/david/Documents/Django/tutorial2/base1/base1/urls.py 
in , line 2  Python Executable: /usr/bin/python  Python Version: 
2.7.5  Python Path: 

['/home/david/Documents/Django/tutorial2/base1',
 '/usr/lib/python27.zip',
 '/usr/lib64/python2.7',
 '/usr/lib64/python2.7/plat-linux2',
 '/usr/lib64/python2.7/lib-tk',
 '/usr/lib64/python2.7/lib-old',
 '/usr/lib64/python2.7/lib-dynload',
 '/usr/lib64/python2.7/site-packages',
 '/usr/lib64/python2.7/site-packages/PIL',
 '/usr/local/lib64/python2.7/site-packages',
 '/usr/local/lib/python2.7/site-packages',
 '/usr/lib64/python2.7/site-packages/gtk-2.0',
 '/usr/lib/python2.7/site-packages',
 '/usr/lib64/python2.7/site-packages/wx-2.8-gtk2-unicode']

 Server time: Tue, 14 Jan 2014 12:12:55 -0600
The code whituot 'á'-->a

from django.http import Http404, HttpResponse
import datetime
# coding: utf-8

def hello(request):
return HttpResponse("Hello world")
def home_page(request):
return HttpResponse("Pagina de Inicio")
..
.
.
It's work



El martes, 14 de enero de 2014 13:21:20 UTC-3, Erik Cederstrand escribió:
>
> Den 14/01/2014 kl. 17.04 skrev David Pineda : 
>
>
> > Hello, i'm beginning to learn python+django and i'm doing that handbook 
> https://github.com/jacobian/djangobook.com/blob/master/chapter03.rst 
> > In the example whit datetime i have a problem when i active the utf-8 
> encondig because i use á,ñ, etc (i'm chilean and we talk in spanish) 
> > So, when i deactive it's works fine, but in the future when i do 
> something more i will need the utf8 enconding and all functionalities like 
> datetime working and i don't know  yet how to do to make work together 
> that, 
>
> Please post the code where you are trying to use non-ASCII characters. 
> What did you try, and what is the exact error message you see? 
>
> Thanks, 
> Erik

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/67d88b83-2be9-4295-93f5-c285f760736c%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Problem with Form with ForeignKey field

2014-01-14 Thread Drew Ferguson
Hi

Django 1.5

I have a model which includes a ForeignKey field defined likes this

class Document(models.Model):
  name = models.CharField(max_length=25, unique=True,
null=False,blank=False) 
  target = models.CharField(max_length=12,
choices=TARGETS,default='report') 
  content = models.TextField(null=False, blank=False)
  fieldlist = models.TextField(null=True, blank=True)
  multitarget = models.BooleanField(default=True, null=False,blank=False) 
  template = models.ForeignKey('Template',null=True,blank=True,
related_name='documents') 
  animal = models.ForeignKey('Animal',null=True,blank=True,
related_name='+')

the Animal table is quite large (>3000 records)

When a form template is called, there are no input fields rendered, just a
"save" button

If the Animal field is suppressed in the form with

class Meta(object):
model = Document
exclude = ['animal',]

the form renders correctly with appropriate input fields

Could someone suggest how to track down what is causing the problem with
the Animal selector when it is being generated? Is there a data issue
perhaps?

Thanks
-- 
Drew

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/20140114162612.1df8c369%40blacktav.fergiesontour.org.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Encoding UTF 8 (añ,etc) and datetime function

2014-01-14 Thread Erik Cederstrand
Den 14/01/2014 kl. 17.04 skrev David Pineda :

> Hello, i'm beginning to learn python+django and i'm doing that handbook 
> https://github.com/jacobian/djangobook.com/blob/master/chapter03.rst
> In the example whit datetime i have a problem when i active the utf-8 
> encondig because i use á,ñ, etc (i'm chilean and we talk in spanish)
> So, when i deactive it's works fine, but in the future when i do something 
> more i will need the utf8 enconding and all functionalities like datetime 
> working and i don't know  yet how to do to make work together that,

Please post the code where you are trying to use non-ASCII characters. What did 
you try, and what is the exact error message you see?

Thanks,
Erik

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/FA141EEA-124A-4480-A0AC-537E489B86F0%40cederstrand.dk.
For more options, visit https://groups.google.com/groups/opt_out.


Encoding UTF 8 (añ,etc) and datetime function

2014-01-14 Thread David Pineda
Hello, i'm beginning to learn python+django and i'm doing that handbook 
https://github.com/jacobian/djangobook.com/blob/master/chapter03.rst
In the example whit datetime i have a problem when i active the utf-8 
encondig because i use á,ñ, etc (i'm chilean and we talk in spanish)
So, when i deactive it's works fine, but in the future when i do something 
more i will need the utf8 enconding and all functionalities like datetime 
working and i don't know  yet how to do to make work together that,
Thanks for help me :)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/df66d6fa-afbb-4c07-90ea-be19308e5485%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Jquery Ajax Autocomplete

2014-01-14 Thread Erik Cederstrand

Den 14/01/2014 kl. 15.22 skrev Ali Hayder :

> Hello 
> Timothy W. Cook
> Thanks for your quick answere. I followed your link 
> "http://flaviusim.com/blog/AJAX-Autocomplete-Search-with-Django-and-jQuery/;. 
> It's not working. I am providing you the mozilla firefox debug screenshot. 
> Please help me. 

Your screenshot says that your local URL http://localhost:8000/api/get_drugs/ 
is returning HTTP 500 errors. You need to find out why. If you are running the 
Django development server, have a look at the command line.

Erik

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3FFFE773-33E5-4FF4-9697-BC0D4B56861D%40cederstrand.dk.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Jquery Ajax Autocomplete

2014-01-14 Thread Timothy W. Cook
Well, it isn't my site, but the link appears to be working okay.  I assume
yo mean you had trouble with the example?  There is an email link on the
site.


On Tue, Jan 14, 2014 at 12:22 PM, Ali Hayder  wrote:

> Hello
>> Timothy W. Cook
>
> Thanks for your quick answere. I followed your link "
> http://flaviusim.com/blog/AJAX-Autocomplete-Search-with-Django-and-jQuery/;.
> It's not working. I am providing you the mozilla firefox debug screenshot.
> Please help me.
>
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/0ad6ee82-4f46-44d6-baf9-52bb39c7e668%40googlegroups.com
> .
>
> For more options, visit https://groups.google.com/groups/opt_out.
>



-- 
MLHIM VIP Signup: http://goo.gl/22B0U

Timothy Cook, MSc   +55 21 94711995
MLHIM http://www.mlhim.org
Like Us on FB: https://www.facebook.com/mlhim2
Circle us on G+: http://goo.gl/44EV5
Google Scholar: http://goo.gl/MMZ1o
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2B%3DOU3WK7Q%2BX__%2BffUT7V3yfKyRdC4v5gFkoCe8WodiCmfZRGw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: DateTimeQuery object has no attribute tzinfo when USE_TZ is True

2014-01-14 Thread Kush Goyal
Thanks Tom, problem solved!

On Monday, 13 January 2014 20:14:51 UTC+5:30, Tom Evans wrote:
>
> On Sat, Jan 11, 2014 at 4:51 AM, Kush Goyal 
>  
> wrote: 
> > I am using postgres as my database. I have a model called Invoice with a 
> > datetime field. I get an error when I run the query: 
> > 
> > Invoice.objects.datetimes('date_field','day') 
> > 
> > The error is: 
> > 
> > AttributeError: 'DateTimeQuery' object has no attribute 'tzinfo' 
> > 
> > This happens when USE_TZ setting is set to True in my settings file. 
> > 
> > I have read the documentation on django docs about datetimes query and 
> it 
> > says that when using postgres pytz is not required. But I installed pytz 
> > anyway and tried again but still got the error. 
> > 
> > When I set USE_TZ to false the query runs fine and there are no errors. 
> > 
> > I found this ticket on django website which reports this error but I do 
> not 
> > know how to use the patch it talks about. 
> > 
> > https://code.djangoproject.com/ticket/21432 
> > 
> > Can someone please tell me how to run the query without errors with 
> > USE_TZ=True. 
>
> Update to django 1.6.1 or later, when this bug was fixed. 
>
> Cheers 
>
> Tom 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2b67b578-e978-4478-9d63-367089681d96%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: DecimalField Problem

2014-01-14 Thread Tom Evans
On Tue, Jan 14, 2014 at 7:23 AM, Eric Rouleau  wrote:
> The problem seems to be in the postgres backend or Psycopg 2.5.2 adapter...
> I have the same problem and the data in postgres is 0. but when
> fetched by django it comes up as Decimal("0E-8") (with shell access not only
> admin), if I switch to sqlite3 backend then it works perfectly
>

Decimal("0E-8") == Decimal(0) == Decimal(0.0)

If you do not want the python representation of your field to be a
Decimal, do not use DecimalField, use FloatField.

https://docs.djangoproject.com/en/1.5/ref/models/fields/#floatfield-vs-decimalfield

http://docs.python.org/2.7/library/decimal.html#module-decimal

Cheers

Tom

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFHbX1Lw01ObSEdN-9Kvm-yhV-pDOanTNQOE57YD5bGRv2dn2g%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: New in Django

2014-01-14 Thread Erik Cederstrand
Den 14/01/2014 kl. 14.32 skrev Anu Malik :

> I'm new in Django,i am not sure how pickling/caching works?

There’s a description of Django caching here: 
https://docs.djangoproject.com/en/dev/topics/cache/ 

Django uses the Python pickle module internally: 
http://docs.python.org/2/library/pickle.html Except for sessions, where JSON 
serializing is used (from Django 1.6, at least: 
https://docs.djangoproject.com/en/dev/releases/1.6/#default-session-serialization-switched-to-json).

Erik

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/03FFCA2A--4555-B9FC-DB138740E0AD%40cederstrand.dk.
For more options, visit https://groups.google.com/groups/opt_out.


Re: nginx server not reflecting changes

2014-01-14 Thread Sandeep kaur
On Sun, Jan 12, 2014 at 9:48 PM, Manu  wrote:
>
> Try to reload nginx.
>
>> sudo nginx -s reload
>
>
> or stop it and restart
>
>> sudo nginx -s stop
>> sudo nginx
>
These doesn't make any change.

>
> if it's still not reflecting those changes, check which settings.py is
being used by runserver and the gunicorn. Or, the problem could be that you
have to restart gunicorn
>
>> sudo supervisorctl restart [gunicorn-program-name]
>

When I use $ps -aux command to see which gunicorn program is running. It
shows no job running, but server is nicely configured and is running. I am
new to nginx and gunicorn deployment. Though deployment has been done but
am not able to understand why the changes are not visible and which program
is running which is behind the deployment.
Your help will be highly appreciated.
Thank you.


-- 
Sandeep Kaur
E-Mail: mkaurkha...@gmail.com
Blog: sandymadaan.wordpress.com

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAF66xG1yuqXCv%2BRDpKnm0y1En5k%2BrwLC62wE5bi9Wnv5SLUM8w%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


New in Django

2014-01-14 Thread Anu Malik
Hi All,

I'm new in Django,i am not sure how pickling/caching works?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a5a9f847-348b-4434-b3d7-8f8a118be2af%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Jquery Ajax Autocomplete

2014-01-14 Thread megaBos
Have a look at django selectable

http://django-selectable.readthedocs.org/en/v0.7.X/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/09d2af2c-c731-4296-a553-80cb05c8f1fd%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: NoReverseMatch error on redirect

2014-01-14 Thread Brad Rice
I figured it out. I had a namespaced url so it needed:

return HttpResponseRedirect(reverse('requestform:registrant_add', 
kwargs={'app_id': obj.id}))

On Monday, January 13, 2014 12:22:59 PM UTC-5, Brad Rice wrote:
>
> I have a mulit-page form I am building. I get the start page to enter the 
> data for the application, validate and save. When I try using reverse to 
> move to the next page I get this error:
>
> NoReverseMatch at /requestform/start/Reverse for 'registrant_add' with 
> arguments '()' and keyword arguments '{'app_id': 11}' not found.
>
> I have this url in my urls.py
>
> url(r'^step1/(?P\d+)/$, RegistrantCreate.as_view(), 
> name="registrant_add"),
>
> I am trying to call the view this way:
>
> class ApplicationCreate(CreateView):
> model = Application
> form_class = ApplicationForm
> slug_field = 'created_by'
> template_name = 'requestform/start_form.html'
>
> @method_decorator(login_required)
> def dispatch(self, *args, **kwargs):
> return super(ApplicationCreate, self).dispatch(*args, **kwargs)
>
>
> def form_valid(self, form):
> obj = form.save(commit=False)
> obj.created_by = self.request.user
> obj.created = datetime.datetime.today()
> obj.modified = datetime.datetime.today()
> obj.save()
> return HttpResponseRedirect(reverse('registrant_add', 
> kwargs={'app_id': obj.id}))
>
> Why doesn't django recognize the named url 'registrant_add' and redirect 
> to it?
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c8908fe0-1b86-4dcb-a977-cb4a6c999186%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: DecimalField Problem

2014-01-14 Thread Eric Rouleau
The problem seems to be in the postgres backend or Psycopg 2.5.2 adapter... 
I have the same problem and the data in postgres is 0. but when 
fetched by django it comes up as Decimal("0E-8") (with shell access not 
only admin), if I switch to sqlite3 backend then it works perfectly

On Thursday, January 9, 2014 3:37:38 AM UTC-5, Timothy W. Cook wrote:
>
>
> On Wed, Jan 8, 2014 at 10:42 PM, Dennis Lee Bieber 
>  > wrote:
>  
>
>> If Django's "DecimalField" is NOT use Python's Decimal type, I'd 
>> be
>>
>  concerned... Python's Decimal is NOT a "float".
>>
>> However, the conversion of a Decimal to/from PostgreSQL might 
>> result in
>> a floating point value -- which I'd consider a flaw in the database 
>> adapter
>> as PostgreSQL does have a NUMERIC data type that should map directly to
>> Python Decimal.
>> --
>>
>
> It does use decimal.Decimal and it does map to PostgreSQL numeric.   The 
> representation via the ORM though ends up being in scientific number format 
> in the admin interface.  This is what caused my concern.  I expected a 
> visually decimal number; a 0  or as PostgreSQL/PGAdmin displays it, 
> 0.00. 
>
>
>  
> -- 
> MLHIM VIP Signup: http://goo.gl/22B0U
> 
> Timothy Cook, MSc   +55 21 94711995
> MLHIM http://www.mlhim.org
> Like Us on FB: https://www.facebook.com/mlhim2
> Circle us on G+: http://goo.gl/44EV5
> Google Scholar: http://goo.gl/MMZ1o
> LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
>  

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4e7c7a58-789e-49d7-8445-4e1dd46c8545%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Jquery Ajax Autocomplete

2014-01-14 Thread Timothy W. Cook
Okay, take a breath. The world will still be here tomorrow.  :-)

Then take a look here:
http://flaviusim.com/blog/AJAX-Autocomplete-Search-with-Django-and-jQuery/




On Tue, Jan 14, 2014 at 9:37 AM, Ali Hayder  wrote:

> Hello guys,
> In my project's home page I have two forms for input two mobiles name for
> comparison. So I need to integrate ajax autocomplete in those input forms.
> I tried according to "Mike Hibbert" youtube tutorial. I am freaking out
> about this issue. I have not enough time to do this.
> Plzzze help me :( I need it badly.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/75bd596f-ebdd-4cee-89c1-1bc6e768dad7%40googlegroups.com
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>



-- 
MLHIM VIP Signup: http://goo.gl/22B0U

Timothy Cook, MSc   +55 21 94711995
MLHIM http://www.mlhim.org
Like Us on FB: https://www.facebook.com/mlhim2
Circle us on G+: http://goo.gl/44EV5
Google Scholar: http://goo.gl/MMZ1o
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2B%3DOU3UdHW4wGqzSVGYktjUgG9QhW9FAPe7kBTt6Uh03VikynQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Jquery Ajax Autocomplete

2014-01-14 Thread Ali Hayder
Hello guys,
In my project's home page I have two forms for input two mobiles name for 
comparison. So I need to integrate ajax autocomplete in those input forms. 
I tried according to "Mike Hibbert" youtube tutorial. I am freaking out 
about this issue. I have not enough time to do this. 
Plzzze help me :( I need it badly.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/75bd596f-ebdd-4cee-89c1-1bc6e768dad7%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: app to record and play video

2014-01-14 Thread Piyush D


On Sunday, January 12, 2014 11:35:26 PM UTC+5:30, Piyush D wrote:
>
> Hi,
> I'm trying to build an app that records videos using webcam and plays it 
> on demand. Are there any resources/documentations on how to do this in 
> Django?
>

@Mike: FileField can be used for uploading video files. I want to use the 
user's webcam to capture a video and then I will use FileField to store it.

@Kelly: Thanks for the link, I'll try to use it in django templates and see 
if it works.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/503b3dc6-93c1-432c-967b-d92623dfa149%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.