Re: HELP with unicode!!!!!

2012-05-01 Thread Kejun He
Hi,
  it may because of the csv file sometimes, try to save the file as utf-8
or utf-8 no-bom.



On Tue, May 1, 2012 at 7:08 PM, dizzydoc  wrote:

> Hi ,
>
> i have lost a lot of time looking for a solution.
>
> My problem is, while i a reading csv in python using
>
> csv_file  = open(path_file, "rb")
> reader = csv.reader(csv_file)
>
> whenever i perform any operation on the string returned in each cell i
> get this error
>
> *** UnicodeEncodeError: 'ascii' codec can't encode character u'\xa0'
> in position 34: ordinal not in range(128)
>
> i tried decoding the value as
>
> val.decode('utf-8')
>
> ...this helped to reduce a few encodings but gets stuck for
> the encoding "\xa0"
> Please HELP!
>
> 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+unsubscr...@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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: [help] Server Config: django + uwsgi + nginx

2012-05-01 Thread easypie
Thanks. I was missing the virtualenv= mentions earlier. I'm glad I 
know this those settings are meant for development only. I was a little 
confused thinking that was ready for deployment. I'm new to all this and 
get confuse sometimes.


On Tuesday, May 1, 2012 8:04:00 AM UTC-7, Kurtis wrote:
>
> Judging from your Import Error -- I think you're having a problem with 
> Django not being on the Python path. In my uwsgi configuration file (I used 
> .xml), it looks like this:
>
> 
> 
> DJANGO_SETTINGS_MODULE=fireflie.settings
> 4
> 0.0.0.0:7999
> /home/fireflie/staging/fireflie/
> django.core.handlers.wsgi:WSGIHandler()
> /home/fireflie/staging/fireflie/
> /home/fireflie/staging/
> /var/log/uwsgi/uwsgi.log
> /tmp/fireflie-staging.pid
> 
>
> Note: That's not guaranteed to be production-ready (we're just using it 
> for development) and I'm also not using a virtual environment (we use a 
> whole sever for the single Django application). In other words, I'm not 
> following best practices by a large margin. Good luck!
>
>
> On Mon, Apr 30, 2012 at 7:36 PM, Karl Sutt  wrote:
>
>> I am not entirely sure what you mean by that. If you mean the nginx 
>> equivalent of Apache VirtualHosts then the nginx wiki explains it quite 
>> nicely http://wiki.nginx.org/ServerBlockExample. Is that what you meant?
>>
>> Karl Sutt
>>
>>
>>
>> On Mon, Apr 30, 2012 at 7:04 PM, easypie  wrote:
>>
>>> does your configuration allow for running multiple sites?
>>>
>>>
>>> On Sunday, April 29, 2012 12:01:27 PM UTC-7, Karl Sutt wrote:

 Here is my uWSGI command and nginx.conf contents:

 uwsgi -- http://www.dpaste.org/**aiJuq/ 
 nginx -- http://www.dpaste.org/**bAG0o/ 

 I've used it for a Flask application, but I've just tested it and it 
 works for a Django project as well. Note that wsgi.py file in the uwsgi 
 command is the Python file that Django generates when you first create a 
 project, there is no need to change it.

 Good luck!

 Karl Sutt


 On Sun, Apr 29, 2012 at 6:49 PM, easypie  wrote:

> I have this file that was created for me by one of the users in 
> django's irc channel. I edited to have the right information inserted but 
> I"m not sure what I'm doing wrong to not make it work. I've spent some 
> time 
> trying to understand each line by searching the web. There's still a 
> thing 
> or two that's missing from the puzzle. Maybe it's the server config that 
> has a flaw or the way I went about it. I haven't done a fresh install of 
> uwsgi and nginx yet. However, please take a look to see if there's an 
> error 
> or solution that could work. Thanks.
>
> Link to code: http://www.dpaste.org/**wWVd3/
>
> -- 
> 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/-/**2rekHP0I6V0J
> .
> 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 view this discussion on the web visit 
>>> https://groups.google.com/d/msg/django-users/-/sMsRN5iG9NQJ.
>>>
>>> To post to this group, send email to django-users@googlegroups.com.
>>> To unsubscribe from this group, send email to 
>>> django-users+unsubscr...@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+unsubscr...@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 view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/cPvZyCPXPNUJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: [help] Server Config: django + uwsgi + nginx

2012-05-01 Thread easypie
how would i start that?
sudo uwsgi start
sudo service nginx start?

On Sunday, April 29, 2012 12:01:27 PM UTC-7, Karl Sutt wrote:
>
> Here is my uWSGI command and nginx.conf contents:
>
> uwsgi -- http://www.dpaste.org/aiJuq/
> nginx -- http://www.dpaste.org/bAG0o/
>
> I've used it for a Flask application, but I've just tested it and it works 
> for a Django project as well. Note that wsgi.py file in the uwsgi command 
> is the Python file that Django generates when you first create a project, 
> there is no need to change it.
>
> Good luck!
>
> Karl Sutt
>
>
> On Sun, Apr 29, 2012 at 6:49 PM, easypie  wrote:
>
>> I have this file that was created for me by one of the users in django's 
>> irc channel. I edited to have the right information inserted but I"m not 
>> sure what I'm doing wrong to not make it work. I've spent some time trying 
>> to understand each line by searching the web. There's still a thing or two 
>> that's missing from the puzzle. Maybe it's the server config that has a 
>> flaw or the way I went about it. I haven't done a fresh install of uwsgi 
>> and nginx yet. However, please take a look to see if there's an error or 
>> solution that could work. Thanks.
>>
>> Link to code: http://www.dpaste.org/wWVd3/
>>
>> -- 
>> 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/-/2rekHP0I6V0J.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to 
>> django-users+unsubscr...@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 view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/Haw_P9fLiH4J.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: HELP with unicode!!!!!

2012-05-01 Thread JHeasly
Also, have a look at this slidedeck: http://farmdev.com/talks/unicode/

It's from a PyCon 2008 talk, "Unicode In Python, Completely Demystified" A 
video of the talk is at http://www.youtube.com/watch?v=cecJ9o5GGmw, but the 
audio's miserable, and the slides are pretty good, so it may be all you 
need to get your head around what's going on.

Also, in your code example, the error says Unicode*Encode*Error, *not*Decode, 
so try 
val.*encode*('utf-8')(not val.*decode*('utf-8')).

— John

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



Re: serving client uploaded files

2012-05-01 Thread Nenad Cikic
This looks interesting, thanks

Il giorno martedì 1 maggio 2012 17:37:33 UTC+2, Tino de Bruijn ha scritto:
>
> You probably want to implement this with X-Sendfile (or X-Accel-Redirect 
> for Nginx) headers. Those tell the frontend server to serve a specific file.
>
> This explains it a bit. 
> http://stackoverflow.com/questions/1156246/having-django-serve-downloadable-files
>
> By googling you will find many examples.
>
>
> Tino
>
>
>

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



Re: Paramiko EOFErrors start to occur after a while

2012-05-01 Thread Kurtis Mullins
I messed with the SFTP implementatoin a while back. I noticed it was pretty
tough and, if I'm not mistaken, a bit out-dated. We ended up moving to
Amazon S3 so it wasn't a big deal.

Anyways, maybe you could try using another file system? SSH isn't really an
ideal solution for this sort of a problem -- even though it works as a
great starting point.

I'm not sure if that helps much but good luck to you!

On Tue, May 1, 2012 at 11:49 AM, Tino de Bruijn  wrote:

> Hi,
>
> My setup is the following: I have two webservers that serve all dynamic
> request. I have a seperate static file server (that also has some celery
> queue workers running). When images are uploaded by users, those images are
> uploaded to the webservers, and processed async by a queue. In the job they
> are transfered to the static file server and resized. For the admin
> however, I want the transfering and resizing done right then, so that when
> admins post content, it is immediatly visible. Admins post different
> content than users, so this is implemented by using a different field on
> the models. The admin images are transfered to the static file server
> directly by using sftpstorage from django-storages.
>
> The problem is that paramiko (used by django-storages for the sftp
> implementation) starts to throw EOFErrors. This doesn't always happen. When
> the mod_wsgi instance is fresh, everything works, but after a while these
> errors start occurring. Touching the wsgi.py file makes everything work
> again.
>
> I have build a retry loop (5 times) to try to circumvent network glitches,
> but it consistently fails. If it needs to retry it'll keep failing.
>
> I have two questions:
>
> 1) Does anybody have an idea why this could be happening?
> 2) Is this the best way to implement this strategy, or would you suggest a
> different technique?
>
> Thanks,
>
>
> Tino
>
> --
> 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/-/UXX_dJrQJOwJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: html5 + Django

2012-05-01 Thread Daniel Sokolowski
Hi there, you may also just serve both your static files and django through one 
apache instance – makes for simple setup and you’ll know when you need 
something more complicated.

Sample apache script: http://dpaste.com/741128/

From: yati sagade 
Sent: Monday, April 30, 2012 3:47 PM
To: django-users@googlegroups.com 
Subject: Re: html5 + Django

I suggest Nginx to serve your static files, and possibly also as a reverse 
proxy to point to your Django with Gunicorn/Apache setup (If you haven't 
considered Gunicorn as a production server yet, please do. It is fantastic).


On Mon, Apr 30, 2012 at 11:21 PM, HarpB  wrote:

  It is much better to use Apache for static files than Django. You can still 
run DJango for data validation, but all static content is typically served via 
Apache. In your  virtualhost, you should proxy the /static/ endpoint to the 
/static/ folder in Django app. 


  On Sunday, April 29, 2012 5:39:15 AM UTC-7, collectiveSQL wrote: 
Hi Everyone, 

I'm working on a heavily animated web site using the html5 canvas tag. 
Its mainly made of html, javascript and css static files and I'd like 
to integrate the Google Identity Toolkit for an Oauth 2.0 account 
chooser for signup and registration. 

The first question is Django a good candidate for serving up mainly 
static files and using a small Django app for authentication? 

And secondly what performance impact would this have over straight 
apache? 

More info: 

1. Static web files such as html, javascript and css are stored on 
Amazon AWS S3 
2. Data is loaded via oData using jsdata for animations 
3. Amazon AWS EC2 is used to scale apache web servers 

Thanks in advance.
  -- 
  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/-/p30N-x76AEgJ. 

  To post to this group, send email to django-users@googlegroups.com.
  To unsubscribe from this group, send email to 
mailto:django-users%2bunsubscr...@googlegroups.com.
  For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.




-- 
Yati Sagade

Twitter: @yati_itay

Organizing member of TEDx EasternMetropolitanBypass
http://www.ted.com/tedx/events/4933
https://www.facebook.com/pages/TEDx-EasternMetropolitanBypass/337763226244869



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

Daniel Sokolowski
Web Engineer
Danols Web Engineering
http://webdesign.danols.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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: django and oracle --

2012-05-01 Thread Giovanni Bronzini
Simple one you are missing * item*  just before *['prezzo']*  :-)

On 28 April 2012 18:30, gmail  wrote:

>  hello django boys,
>
> i hope someone here can help me. i have a problem with django e oracle.
> above the code with problem:
>
> insert = """insert into modello (title, descrizione, url, prezzo, sconto)
> values (:title, :descrizione, :url,
>  :prezzo, :sconto)"""
>  try:
>   self.c.execute(insert,{'title':item['title'],
> 'descrizione':item['descrizione'],
>  'url':item['url'],
> 'prezzo':['prezzo'], 'sconto':item['sconto']})
>
> when try this code the system report this error:
> ORA-01484:arrays can only be bound to PL/SQL statement
>
> ** any items is a list of different values for title,descrizione etc etc
>
> thanks
> marco
> *
> *
>
> --
> 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+unsubscr...@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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Tools for extending the admin?

2012-05-01 Thread Giovanni Bronzini
Maybe that one ?

https://github.com/saxix/django-iadmin


On 1 May 2012 21:12, Marc Aymerich  wrote:

> On Tue, May 1, 2012 at 5:43 PM, Roy Smith  wrote:
> > I'm working on a site which makes extensive use of admin, and we're
> starting
> > to look at extending/customizing it.  I am aware of django-admin-tools
> > and django-grappelli.  Are there other projects I should be looking at
> for
> > admin extension/customization ideas?
>
> Maybe you want to take a look at django-fluent-dashboard
>
> https://github.com/edoburu/django-fluent-dashboard
>
> --
> 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+unsubscr...@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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Tools for extending the admin?

2012-05-01 Thread Marc Aymerich
On Tue, May 1, 2012 at 5:43 PM, Roy Smith  wrote:
> I'm working on a site which makes extensive use of admin, and we're starting
> to look at extending/customizing it.  I am aware of django-admin-tools
> and django-grappelli.  Are there other projects I should be looking at for
> admin extension/customization ideas?

Maybe you want to take a look at django-fluent-dashboard

https://github.com/edoburu/django-fluent-dashboard

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



Re: Django timezone doesn't show the right time?

2012-05-01 Thread akaariai
I see I am talking about concepts which are not yet familiar to you.

By template I mean Django's HTML template engine. This is introduced
in part 3 of the tutorial.

The reason for the errors is that Poll is not an instance, it is the
class so it doesn't have pub_date. poll isn't assigned to yet. You
could do poll = Poll.objects.all()[0], and then poll would be assigned
the first Poll object instance, fetched from the database.

 - Anssi

On May 1, 9:45 pm, Dan Santos  wrote:
> Hi thanks for taking the time to explain to me!
>
> Unfortunately I still don't understand the outputs that I get in Python
> console, maybe it's because I don't understand the concept of templates.
> But this is what I tried to do in Python console.
>
> >>> p=Poll(question="Giddeup'ah!", pub_date=timezone.now())
> >>> p.save()
> >>> p.id
> 4
> >>> p.question
> "Giddeup'ah!"
> >>> *p.pub_date*
>
> datetime.datetime(2012, 5, 1, *18, 25*, 39, 804854, tzinfo=<*UTC*>)
>
> >>> *Poll.objects.all()*
>
> [,  2012-04-26 10:30:23.624835+00:00>,
> ,  2012-05-01 *18:25*:39.804854*+00:00*>]
>
> p.pub_date and Poll.objects.all() show the same time info, so how do I see
> the time with the simplest of templates?
>
> Also when I tried typing "poll.pub_date" in different ways I get these
> errors.
>
> >>> *Poll.pub_date*
>
> Traceback (most recent call last):
>   File "", line 1, in 
> AttributeError: type object 'Poll' has no attribute 'pub_date'
>
> >>> *poll.pub_date*
>
> Traceback (most recent call last):
>   File "", line 1, in 
> NameError: name 'poll' is not defined
>
> >>> *poll.pub_date()*
>
> Traceback (most recent call last):
>   File "", line 1, in 
> NameError: name 'poll' is not defined
>
> >>> *Poll.pub_date()*
>
> Traceback (most recent call last):
>   File "", line 1, in 
> AttributeError: type object 'Poll' has no attribute 'pub_date'
>
> Here's a better overview of what my relevant files looks like and what
> setup I have tried to use.  Maybe it will help in finding if I
> have mis-configured 
> something.http://www.python-forum.org/pythonforum/viewtopic.php?f=19&t=34082
>
>
>
>
>
>
>
> On Tuesday, May 1, 2012 3:16:33 PM UTC+2, akaariai wrote:
>
> > On Apr 30, 11:03 pm, Dan Santos  wrote:
> > > Hi I'm a total programming newbie!
>
> > > ### INTRO ###
> > > I have been following this tutorial and the timezone outputs confuses
> > > me.
> >https://docs.djangoproject.com/en/1.4/intro/tutorial01/#playing-with-...
>
> > > And I'm still confused after reading these explanations, I basically
> > > need some really dumbed down answers to understand this timezone
> > > business:
>
> > > TIME_ZONE setting: How does it work?
> >http://groups.google.com/group/django-users/browse_thread/thread/bebb...
>
> > > ### QUESTION ###
> > > * Europe/Brussels has UTC+2 during summer time.
>
> > > When I run this as I follow the Django tutorial, then the time (20:34)
> > > is behind by 2 hours to my local time and UTC displays +00:00.
> > > Shouldn't it display 22:34 +02:00 instead for a server located at
> > > Europe/Brussels?
>
> > > >>> Poll.objects.all()
>
> > > ]
>
> > Internally Django works in UTC . When you display a value in a
> > template or in a form it will be converted to the currently active
> > time zone (by default settings.TIMEZONE). So, when you just do
> > Poll.objects.all() you will see the UTC time, as this is Python
> > internal representation. If you would do {{poll.pub_date}} in the
> > template, it would be displayed in the time zone you have currently
> > active.
>
> >  - 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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django timezone doesn't show the right time?

2012-05-01 Thread Dan Santos
Hi thanks for taking the time to explain to me!

Unfortunately I still don't understand the outputs that I get in Python 
console, maybe it's because I don't understand the concept of templates.
But this is what I tried to do in Python console.

>>> p=Poll(question="Giddeup'ah!", pub_date=timezone.now())
>>> p.save()
>>> p.id
4
>>> p.question
"Giddeup'ah!"
>>> *p.pub_date*
datetime.datetime(2012, 5, 1, *18, 25*, 39, 804854, tzinfo=<*UTC*>)

>>> *Poll.objects.all()*
[, , 
, ]



p.pub_date and Poll.objects.all() show the same time info, so how do I see 
the time with the simplest of templates?



Also when I tried typing "poll.pub_date" in different ways I get these 
errors.

>>> *Poll.pub_date*
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: type object 'Poll' has no attribute 'pub_date'

>>> *poll.pub_date*
Traceback (most recent call last):
  File "", line 1, in 
NameError: name 'poll' is not defined

>>> *poll.pub_date()*
Traceback (most recent call last):
  File "", line 1, in 
NameError: name 'poll' is not defined

>>> *Poll.pub_date()*
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: type object 'Poll' has no attribute 'pub_date'



Here's a better overview of what my relevant files looks like and what 
setup I have tried to use.  Maybe it will help in finding if I 
have mis-configured something.
http://www.python-forum.org/pythonforum/viewtopic.php?f=19&t=34082





On Tuesday, May 1, 2012 3:16:33 PM UTC+2, akaariai wrote:
>
> On Apr 30, 11:03 pm, Dan Santos  wrote: 
> > Hi I'm a total programming newbie! 
> > 
> > ### INTRO ### 
> > I have been following this tutorial and the timezone outputs confuses 
> > me.
> https://docs.djangoproject.com/en/1.4/intro/tutorial01/#playing-with-... 
> > 
> > And I'm still confused after reading these explanations, I basically 
> > need some really dumbed down answers to understand this timezone 
> > business: 
> > 
> > TIME_ZONE setting: How does it work?
> http://groups.google.com/group/django-users/browse_thread/thread/bebb... 
> > 
> > ### QUESTION ### 
> > * Europe/Brussels has UTC+2 during summer time. 
> > 
> > When I run this as I follow the Django tutorial, then the time (20:34) 
> > is behind by 2 hours to my local time and UTC displays +00:00. 
> > Shouldn't it display 22:34 +02:00 instead for a server located at 
> > Europe/Brussels? 
> > 
> > >>> Poll.objects.all() 
> > 
> > ] 
>
> Internally Django works in UTC . When you display a value in a 
> template or in a form it will be converted to the currently active 
> time zone (by default settings.TIMEZONE). So, when you just do 
> Poll.objects.all() you will see the UTC time, as this is Python 
> internal representation. If you would do {{poll.pub_date}} in the 
> template, it would be displayed in the time zone you have currently 
> active. 
>
>  - Anssi

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



Re: Problem with a clean in inline formset

2012-05-01 Thread Ernesto Guevara
Solution:

def clean(self):
   if any(self.errors):
   # Don't bother validating the formset unless each form is
valid on its own
   return
   for i in range(0, self.total_form_count()):
   form = self.forms[i]
   cleaned_data = form.clean()
   display = cleaned_data.get('display', None)
   if cleaned_data['DELETE'] == False:
 if display.max_windows() >= display.windows:
   raise forms.ValidationError("The display have all
windows occupied.")

Put the line if cleaned_data['DELETE'] == False:  to check if the inline
have the attribute DELETE and if is false, to ignore deleted rows in
formset that have true in this attribute. =)

2012/4/30 Guevara 

> Hello!
>
> The (if display.max_windows() >= display.windows) works fine to
> prevent insert. Behaves as expected.
> But is raised even when the row is REMOVED from the edit formset. =/
>
> ## Models
>
> class Display(models.Model):
>windows = models.IntegerField()
>
> def max_windows(self):
>total = self.window_set.all().count() #window is a
> intermediary class to campaign
>if total:
>return total
>
> ## Clean method in CampaignInlineFormSet
>
> def clean(self):
>if any(self.errors):
># Don't bother validating the formset unless each form is
> valid on its own
>return
>for i in range(0, self.total_form_count()):
>form = self.forms[i]
>cleaned_data = form.clean()
>display = cleaned_data.get('display', None)
>if display.max_windows() >= display.windows:
>raise forms.ValidationError("The display have all
> windows occupied.")
>
> This "if" can not stop me remove a row in inline formset. How can I
> fix this?
> Regards.
>
> --
> 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+unsubscr...@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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Paramiko EOFErrors start to occur after a while

2012-05-01 Thread Tino de Bruijn
Hi,

My setup is the following: I have two webservers that serve all dynamic 
request. I have a seperate static file server (that also has some celery 
queue workers running). When images are uploaded by users, those images are 
uploaded to the webservers, and processed async by a queue. In the job they 
are transfered to the static file server and resized. For the admin 
however, I want the transfering and resizing done right then, so that when 
admins post content, it is immediatly visible. Admins post different 
content than users, so this is implemented by using a different field on 
the models. The admin images are transfered to the static file server 
directly by using sftpstorage from django-storages.

The problem is that paramiko (used by django-storages for the sftp 
implementation) starts to throw EOFErrors. This doesn't always happen. When 
the mod_wsgi instance is fresh, everything works, but after a while these 
errors start occurring. Touching the wsgi.py file makes everything work 
again.

I have build a retry loop (5 times) to try to circumvent network glitches, 
but it consistently fails. If it needs to retry it'll keep failing.

I have two questions:

1) Does anybody have an idea why this could be happening?
2) Is this the best way to implement this strategy, or would you suggest a 
different technique?

Thanks,


Tino

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



Tools for extending the admin?

2012-05-01 Thread Roy Smith
I'm working on a site which makes extensive use of admin, and we're 
starting to look at extending/customizing it.  I am aware of 
django-admin-tools and django-grappelli.  Are there other projects I should 
be looking at for admin extension/customization ideas?

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



Re: serving client uploaded files

2012-05-01 Thread Tino de Bruijn
You probably want to implement this with X-Sendfile (or X-Accel-Redirect 
for Nginx) headers. Those tell the frontend server to serve a specific file.

This explains it a 
bit. 
http://stackoverflow.com/questions/1156246/having-django-serve-downloadable-files

By googling you will find many examples.


Tino

On Tuesday, May 1, 2012 4:47:58 PM UTC+2, Kurtis wrote:
>
> You could use a pseudo-random filename so that it's very unlikely people 
> will be able to easily find other's photos. 
>
> If you're very concerned with users being authenticated before viewing the 
> media (which to me, sounds like there won't be a huge load on that segment 
> of your web application) then you can easily use Django to simply store the 
> files to a private directory and let Django handle serving the images. It's 
> not the most efficient technique in terms of speed but it's a reasonable 
> compromise for the security you're looking for.
>
> On Tue, May 1, 2012 at 4:23 AM, Nenad Cikic  wrote:
>
>> Hello,
>> how can i serve the file uploaded files (images)? What I mean I have few 
>> model with images, and I see images in the change form.
>> The problem is that I can see the same images by writing directly the 
>> media path in the web address. And since the model is designed to have data 
>> split between the users I do not want the images to be seen that way.
>> I have looked and found
>>
>> https://docs.djangoproject.com/en/dev/howto/static-files/?from=olddocs#staticfiles-other-directories
>> What I have done is to add to the url the following
>> url(r'^media/(?P.*)$', "registracija.views.myuploadedfileview", 
>> {'document_root': settings.MEDIA_ROOT,}),
>>
>> and then the view is something as:
>>   #parse the request and try to undestand if the image is mine 
>>   if yes:
>>  return serve(request, path, document_root, show_indexes)
>>   else:
>>  return HttpResponseNotFound()
>>
>> This is working; what bothers me is that the serve function is, as in 
>> docs, stated to be used only in development. 
>> But if I serve the images directly by the web server, would I bypass my 
>> security checks?
>> Is there any other way to achieve my means?
>> Thanks
>> Nenad
>>
>> -- 
>> 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/-/qJAqbma_ZdAJ.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to 
>> django-users+unsubscr...@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 view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/vN8fm7ylyrEJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



[VVIP] Displaying Tables in Admin Interface using non-foreign key

2012-05-01 Thread Aditya Sriram M
My models:
*
*
>
> *# models.py
> class Model1(models.Model):
> pk = models.BigIntegerField(primary_key=True)
> col1 = models.IntegerField()
> class Model2(models.Model):
> fk = models.ForeignKey(Model1)
> col1 = models.CharField(max_length=255)
> # admin.py
> class  Model1Admin(admin.ModelAdmin):
> list_display = ('pk', 'col1', 'get_model2s_col1')
> 
> . . .
>
> def get_model2s_col1(self, obj):
>  # WHAT TO WRITE HERE*

 

*admin.site.register(Model1, Model1Admin) *


How can we access the related table's columns? Can you refer me to some 
documentation as well?

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



Re: [JOB] Urgent - PHP/Python Developer needed

2012-05-01 Thread Cal Leeming [Simplicity Media Ltd]
On Tue, May 1, 2012 at 3:41 PM, Kurtis Mullins wrote:

> Congrats on finding people to fill your position(s), Cal!


Thank you!


>
> At first I read that and thought "man, that's almost insulting". I can
> honestly say that it's not completely unfair to pay someone $20/hour
> -- especially if they're still in school. I barely make more than that as a
> lead-developer for a startup, haha. One of these days it'll get finished
> and I'll have a nice, large project to put on my CV/Portfolio :)
>

Absolutely - I've seen a lot of replies from people saying its a low wage,
but I started off on that very same wage, AND I had to drag my ass into an
office across a 2 hour round trip on public transport whilst working 40
hour weeks.


>
> The sad thing is that you can enter the corporate world and easily hit
> $80,000+/year -- but I know I could never be happy in that kind of a work
> environment.
>

Couldn't agree with you more. I've done the whole working in the city
thing, £65k basic/year etc, and it was fun for the first few months, but
there's more to life than money.

And at those salaries, you can guarantee you're gonna be stressed as hell
and on-call every weekend.

Work satisfaction, opportunities/learning experience, and general life
style means so much more - it just took me a few years to realise :)


>
> On Tue, May 1, 2012 at 7:25 AM, Cal Leeming [Simplicity Media Ltd] <
> cal.leem...@simplicitymedialtd.co.uk> wrote:
>
>> Thanks to everyone for your feedback and to everyone who applied for the
>> position - we had some really great applicants, and one or two
>> exceptionally good ones.
>>
>> The position has now been filled, but we will keep everyone who applied
>> on file for future ref.
>>
>> I should also take the opportunity to mention that we have other openings
>> coming up in the next few months which are purely Python/Django based - and
>> we are also considering taking on interns this year.
>>
>> Cal
>>
>>
>>  ** **
>>>
>>> *From:* django-users@googlegroups.com [mailto:
>>> django-users@googlegroups.com] *On Behalf Of *Cal Leeming [Simplicity
>>> Media Ltd]
>>> *Sent:* Thursday, April 12, 2012 3:28 PM
>>> *To:* django-users@googlegroups.com
>>> *Subject:* Re: [JOB] Urgent - PHP/Python Developer needed
>>>
>>> ** **
>>>
>>> Further update on this - budget has changed so, we can now offer
>>> a higher rate and a part time alternative.
>>>
>>> ** **
>>>
>>> * 1500$/month for 70 hours (20$/hour)
>>>
>>> * 2000$/month for 100 hours (20$/hour)
>>>
>>> ** **
>>>
>>> Thanks
>>>
>>> ** **
>>>
>>> Cal
>>>
>>> On Tue, Apr 10, 2012 at 9:31 PM, Cal Leeming [Simplicity Media Ltd] <
>>> cal.leem...@simplicitymedialtd.co.uk> wrote:
>>>
>>> Hi all,
>>>
>>> ** **
>>>
>>> Another urgent position has come up in our company, applicant needs to
>>> have some experience with using Django but must also be comfortable with
>>> PHP (our clients are a 50/50 split between PHP and Django).
>>>
>>> ** **
>>>
>>> --
>>>
>>> ** **
>>>
>>> Simplicity Media Ltd are an established UK company providing bespoke IT
>>> solutions for a variety of clients across the globe.
>>>
>>> We are currently looking for a flexible and diverse developer to
>>> maintain and extend our existing PHP deployments.
>>>
>>> Our solutions are high volume (peaking at around 5000 requests/minute),
>>> with extremely large databases (400 million+ rows) and large content
>>> servers (15TB+ of media files).
>>>
>>> The successful candidate should have at least 2 years commercial
>>> experience, be fluent OOP, and have a general understanding of what it
>>> means to be a good programmer.
>>>
>>> We're looking for a real person with real emotion, not a corporate robot
>>> - and being a team player is absolutely critical. Our company attitude is
>>> firm but fair, we encourage a healthy mixture of fun/work, and we even have
>>> a 'NSFW' IRC channel!
>>>
>>> Essential skills:
>>> * PHP 5.x (OOP)
>>> * MySQL
>>> * Linux (Debian)
>>> * Bash (shell/ssh etc)
>>>
>>> Desired (non-essential) skills:
>>> * MongoDB
>>> * Redhat
>>> * Percona
>>> * Memcache
>>> * Redis
>>> * Python
>>>
>>> Desired (non-essential) experience:
>>> * CodeIgniter (PHP)
>>> * TubeX (PHP)
>>> * Django (Python)
>>> * JIRA (Atlassian)
>>> * Basecamp
>>> * Zendesk
>>> * Livechat
>>>
>>> MINIMUM CRITERIA:
>>> * MUST be able to work on either EST or GMT+0 timezone
>>> * MUST be able to work 30+ hours a week.
>>> * MUST be comfortable working on 18+ sites.
>>> * MUST be fluent in written & spoken English
>>>
>>> The position is full time, offering around $2000/month (roughly
>>> £1200/month) for the right candidate - price/hours are negotiable.
>>>
>>> This position MUST be filled by 15th April 2012.
>>>
>>> When applying, please also include a cover note explaining why you feel
>>> you would be suitable for this role.
>>>
>>> ** **
>>>
>>> ** **
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users

Re: serving client uploaded files

2012-05-01 Thread Nenad Cikic
OK, thanks

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



Re: [help] Server Config: django + uwsgi + nginx

2012-05-01 Thread Kurtis Mullins
Judging from your Import Error -- I think you're having a problem with
Django not being on the Python path. In my uwsgi configuration file (I used
.xml), it looks like this:



DJANGO_SETTINGS_MODULE=fireflie.settings
4
0.0.0.0:7999
/home/fireflie/staging/fireflie/
django.core.handlers.wsgi:WSGIHandler()
/home/fireflie/staging/fireflie/
/home/fireflie/staging/
/var/log/uwsgi/uwsgi.log
/tmp/fireflie-staging.pid


Note: That's not guaranteed to be production-ready (we're just using it for
development) and I'm also not using a virtual environment (we use a whole
sever for the single Django application). In other words, I'm not following
best practices by a large margin. Good luck!


On Mon, Apr 30, 2012 at 7:36 PM, Karl Sutt  wrote:

> I am not entirely sure what you mean by that. If you mean the nginx
> equivalent of Apache VirtualHosts then the nginx wiki explains it quite
> nicely http://wiki.nginx.org/ServerBlockExample. Is that what you meant?
>
> Karl Sutt
>
>
>
> On Mon, Apr 30, 2012 at 7:04 PM, easypie  wrote:
>
>> does your configuration allow for running multiple sites?
>>
>>
>> On Sunday, April 29, 2012 12:01:27 PM UTC-7, Karl Sutt wrote:
>>>
>>> Here is my uWSGI command and nginx.conf contents:
>>>
>>> uwsgi -- http://www.dpaste.org/**aiJuq/ 
>>> nginx -- http://www.dpaste.org/**bAG0o/ 
>>>
>>> I've used it for a Flask application, but I've just tested it and it
>>> works for a Django project as well. Note that wsgi.py file in the uwsgi
>>> command is the Python file that Django generates when you first create a
>>> project, there is no need to change it.
>>>
>>> Good luck!
>>>
>>> Karl Sutt
>>>
>>>
>>> On Sun, Apr 29, 2012 at 6:49 PM, easypie  wrote:
>>>
 I have this file that was created for me by one of the users in
 django's irc channel. I edited to have the right information inserted but
 I"m not sure what I'm doing wrong to not make it work. I've spent some time
 trying to understand each line by searching the web. There's still a thing
 or two that's missing from the puzzle. Maybe it's the server config that
 has a flaw or the way I went about it. I haven't done a fresh install of
 uwsgi and nginx yet. However, please take a look to see if there's an error
 or solution that could work. Thanks.

 Link to code: http://www.dpaste.org/**wWVd3/

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



Re: No Module Named Generic

2012-05-01 Thread Gerald Klein
Wow, and thanks I must have been staring at it far too long, I appreciate
your help. A fresh set of eyes often is the answer.

thanks again,.

--jerry

On Tue, May 1, 2012 at 9:48 AM, Xavier Ordoquy  wrote:

> Hi,
>
> You should replace django.generic in the urlspatterns string with
> django.views.generic
>
> Regards,
> Xavier Ordoquy
> Linovia.
>
> Le 1 mai 2012 à 16:30, Gerald Klein a écrit :
>
> Hi, I am having a problem, where as django doesn't find the generics
> module. Here is my urls.py
>
> thanks in advance.
>
> from django.conf.urls.defaults import *
>
> from django.views.generic import *
> from coltrane.models import Entry
>
>
> entry_info_dict = {
> 'queryset': Entry.objects.all(),
> 'date_field': 'pub_date',
> }
>
> urlpatterns = patterns('',
> (r'^$', 'django.generic.date_based.archive_index',entry_info_dict,
> 'coltrane_entry_archive_index'),
> (r'^(?P\d{4})/$',
> 'django.generic.date_based.archive_year',entry_info_dict,
> 'coltrane_entry_archive_year'),
> (r'^(?P\d{4})/(?P\w{3})/$',
> 'django.generic.date_based.archive_month',entry_info_dict,
> 'coltrane_entry_archive_month'),
> (r'^(?P\d{4})/(?P\w{3})/(?P\d{2})/$',
> 'django.generic.date_based.archive_day',entry_info_dict,'coltrane_entry_archive_day'),
>
> (r'^(?P\d{4})/(?P\w{3})/(?P\d{2})/(?P[-\w]+)/$',
> 'django.generic.date_based.object_detail',entry_info_dict,'coltrane_entry_detail'),
> )
>
>
> Gerald Klein DBA
> contac...@geraldklein.com
> www.geraldklein.com 
> j...@zognet.com
> 708-599-0352
>
>
> Linux registered user #548580
>
>
>
>
> --
> 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+unsubscr...@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+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 

Gerald Klein DBA

contac...@geraldklein.com

www.geraldklein.com 

j...@zognet.com

708-599-0352


Linux registered user #548580

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



Re: The template tag {% load tz %}

2012-05-01 Thread Kurtis Mullins
http://stackoverflow.com/questions/550632/favorite-django-tips-features  --
Fourth Answer Down from the Top:

from django import template
template.add_to_builtins('project.app.templatetags.custom_tag_module')


On Mon, Apr 30, 2012 at 9:40 PM, CLIFFORD ILKAY
wrote:

> On 04/30/2012 09:21 PM, Rajat Jain wrote:
>
>> Hi,
>>
>> I am shifting to Django 1.4 and want to use the timezone support (for
>> which I want to use {% load tz %} in my templates). The problem is that
>> I have aroudn 30-40 templates, and manually adding these tags to each
>> template is a pain. Is there a way by which I can do this loading by
>> default in all the templates?
>>
>
> Hi Rajat,
>
> You can use sed. See: 
> 
> >.
> --
> Regards,
>
> Clifford Ilkay
> Dinamis
> 1419-3230 Yonge St.
> Toronto, ON
> Canada  M4N 3P6
>
> 
> +1 416-410-3326
>
>
> --
> 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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: HELP with unicode!!!!!

2012-05-01 Thread Ian Clelland
On Tuesday, May 1, 2012, dizzydoc wrote:

> Hi ,
>
> i have lost a lot of time looking for a solution.
>
> My problem is, while i a reading csv in python using
>
> csv_file  = open(path_file, "rb")
> reader = csv.reader(csv_file)
>
> whenever i perform any operation on the string returned in each cell i
> get this error
>
> *** UnicodeEncodeError: 'ascii' codec can't encode character u'\xa0'
> in position 34: ordinal not in range(128)


It's a long-standing limitation with the python csv module that it does not
handle Unicode well. In fact, it's one of the first things mentioned in the
docs:

 http://docs.python.org/library/csv.html

Further down that page, though, is a snippet of code that you should be
able to use (search the page for "unicode_csv_reader")

If that doesn't work, come back here with some code that you've tried and
hopefully we can find a solution

Ian


> i tried decoding the value as
>
> val.decode('utf-8')
>
> ...this helped to reduce a few encodings but gets stuck for
> the encoding "\xa0"
> Please HELP!
>
>
>
>

-- 
Regards,
Ian Clelland


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



Re: No Module Named Generic

2012-05-01 Thread Xavier Ordoquy
Hi,

You should replace django.generic in the urlspatterns string with 
django.views.generic

Regards,
Xavier Ordoquy
Linovia.

Le 1 mai 2012 à 16:30, Gerald Klein a écrit :

> Hi, I am having a problem, where as django doesn't find the generics module. 
> Here is my urls.py
> 
> thanks in advance.
> 
> from django.conf.urls.defaults import *
> 
> from django.views.generic import *
> from coltrane.models import Entry
> 
> 
> entry_info_dict = {
> 'queryset': Entry.objects.all(),
> 'date_field': 'pub_date',
> }
> 
> urlpatterns = patterns('',
> (r'^$', 'django.generic.date_based.archive_index',entry_info_dict, 
> 'coltrane_entry_archive_index'),
> (r'^(?P\d{4})/$', 
> 'django.generic.date_based.archive_year',entry_info_dict, 
> 'coltrane_entry_archive_year'),
> (r'^(?P\d{4})/(?P\w{3})/$', 
> 'django.generic.date_based.archive_month',entry_info_dict, 
> 'coltrane_entry_archive_month'),
> (r'^(?P\d{4})/(?P\w{3})/(?P\d{2})/$', 
> 'django.generic.date_based.archive_day',entry_info_dict,'coltrane_entry_archive_day'),
> (r'^(?P\d{4})/(?P\w{3})/(?P\d{2})/(?P[-\w]+)/$', 
> 'django.generic.date_based.object_detail',entry_info_dict,'coltrane_entry_detail'),
> )
> 
> 
> Gerald Klein DBA
> contac...@geraldklein.com
> www.geraldklein.com
> j...@zognet.com
> 708-599-0352
> 
> Linux registered user #548580 
> 
> 
> 
> 
> -- 
> 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+unsubscr...@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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: serving client uploaded files

2012-05-01 Thread Kurtis Mullins
You could use a pseudo-random filename so that it's very unlikely people
will be able to easily find other's photos.

If you're very concerned with users being authenticated before viewing the
media (which to me, sounds like there won't be a huge load on that segment
of your web application) then you can easily use Django to simply store the
files to a private directory and let Django handle serving the images. It's
not the most efficient technique in terms of speed but it's a reasonable
compromise for the security you're looking for.

On Tue, May 1, 2012 at 4:23 AM, Nenad Cikic  wrote:

> Hello,
> how can i serve the file uploaded files (images)? What I mean I have few
> model with images, and I see images in the change form.
> The problem is that I can see the same images by writing directly the
> media path in the web address. And since the model is designed to have data
> split between the users I do not want the images to be seen that way.
> I have looked and found
>
> https://docs.djangoproject.com/en/dev/howto/static-files/?from=olddocs#staticfiles-other-directories
> What I have done is to add to the url the following
> url(r'^media/(?P.*)$', "registracija.views.myuploadedfileview",
> {'document_root': settings.MEDIA_ROOT,}),
>
> and then the view is something as:
>   #parse the request and try to undestand if the image is mine
>   if yes:
>  return serve(request, path, document_root, show_indexes)
>   else:
>  return HttpResponseNotFound()
>
> This is working; what bothers me is that the serve function is, as in
> docs, stated to be used only in development.
> But if I serve the images directly by the web server, would I bypass my
> security checks?
> Is there any other way to achieve my means?
> Thanks
> Nenad
>
> --
> 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/-/qJAqbma_ZdAJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django - Worldwide Developer Rates - Hourly Income - location and project duration specific

2012-05-01 Thread Kurtis Mullins
Raphael,

According to another topic -- some developers are being paid roughly
$20/hour. It's under a post by Cal Lemmings where he is trying to hire some
entry level developer(s). You might be able to use that information as
well. I just thought I'd let you know.

On Mon, Apr 30, 2012 at 4:24 PM, Raphael wrote:

> **
> Dear djangos,
>
> if you want to hand-in your data anonymously - just send us an email to
> django[at]develissimo.com
> we really need more data to achieve some meaningful results.
>
> http://develissimo.com/forum/topic/107887/
>
> Cheers,
> Raphael
>
>
>  --
> 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+unsubscr...@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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: [JOB] Urgent - PHP/Python Developer needed

2012-05-01 Thread Kurtis Mullins
Congrats on finding people to fill your position(s), Cal!

At first I read that and thought "man, that's almost insulting". I can
honestly say that it's not completely unfair to pay someone $20/hour
-- especially if they're still in school. I barely make more than that as a
lead-developer for a startup, haha. One of these days it'll get finished
and I'll have a nice, large project to put on my CV/Portfolio :)

The sad thing is that you can enter the corporate world and easily hit
$80,000+/year -- but I know I could never be happy in that kind of a work
environment.

On Tue, May 1, 2012 at 7:25 AM, Cal Leeming [Simplicity Media Ltd] <
cal.leem...@simplicitymedialtd.co.uk> wrote:

> Thanks to everyone for your feedback and to everyone who applied for the
> position - we had some really great applicants, and one or two
> exceptionally good ones.
>
> The position has now been filled, but we will keep everyone who applied on
> file for future ref.
>
> I should also take the opportunity to mention that we have other openings
> coming up in the next few months which are purely Python/Django based - and
> we are also considering taking on interns this year.
>
> Cal
>
>
> ** **
>>
>> *From:* django-users@googlegroups.com [mailto:
>> django-users@googlegroups.com] *On Behalf Of *Cal Leeming [Simplicity
>> Media Ltd]
>> *Sent:* Thursday, April 12, 2012 3:28 PM
>> *To:* django-users@googlegroups.com
>> *Subject:* Re: [JOB] Urgent - PHP/Python Developer needed
>>
>> ** **
>>
>> Further update on this - budget has changed so, we can now offer a higher
>> rate and a part time alternative.
>>
>> ** **
>>
>> * 1500$/month for 70 hours (20$/hour)
>>
>> * 2000$/month for 100 hours (20$/hour)
>>
>> ** **
>>
>> Thanks
>>
>> ** **
>>
>> Cal
>>
>> On Tue, Apr 10, 2012 at 9:31 PM, Cal Leeming [Simplicity Media Ltd] <
>> cal.leem...@simplicitymedialtd.co.uk> wrote:
>>
>> Hi all,
>>
>> ** **
>>
>> Another urgent position has come up in our company, applicant needs to
>> have some experience with using Django but must also be comfortable with
>> PHP (our clients are a 50/50 split between PHP and Django).
>>
>> ** **
>>
>> --
>>
>> ** **
>>
>> Simplicity Media Ltd are an established UK company providing bespoke IT
>> solutions for a variety of clients across the globe.
>>
>> We are currently looking for a flexible and diverse developer to maintain
>> and extend our existing PHP deployments.
>>
>> Our solutions are high volume (peaking at around 5000 requests/minute),
>> with extremely large databases (400 million+ rows) and large content
>> servers (15TB+ of media files).
>>
>> The successful candidate should have at least 2 years commercial
>> experience, be fluent OOP, and have a general understanding of what it
>> means to be a good programmer.
>>
>> We're looking for a real person with real emotion, not a corporate robot
>> - and being a team player is absolutely critical. Our company attitude is
>> firm but fair, we encourage a healthy mixture of fun/work, and we even have
>> a 'NSFW' IRC channel!
>>
>> Essential skills:
>> * PHP 5.x (OOP)
>> * MySQL
>> * Linux (Debian)
>> * Bash (shell/ssh etc)
>>
>> Desired (non-essential) skills:
>> * MongoDB
>> * Redhat
>> * Percona
>> * Memcache
>> * Redis
>> * Python
>>
>> Desired (non-essential) experience:
>> * CodeIgniter (PHP)
>> * TubeX (PHP)
>> * Django (Python)
>> * JIRA (Atlassian)
>> * Basecamp
>> * Zendesk
>> * Livechat
>>
>> MINIMUM CRITERIA:
>> * MUST be able to work on either EST or GMT+0 timezone
>> * MUST be able to work 30+ hours a week.
>> * MUST be comfortable working on 18+ sites.
>> * MUST be fluent in written & spoken English
>>
>> The position is full time, offering around $2000/month (roughly
>> £1200/month) for the right candidate - price/hours are negotiable.
>>
>> This position MUST be filled by 15th April 2012.
>>
>> When applying, please also include a cover note explaining why you feel
>> you would be suitable for this role.
>>
>> ** **
>>
>> ** **
>>
>> --
>> 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+unsubscr...@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+unsubscr...@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
> djan

No Module Named Generic

2012-05-01 Thread Gerald Klein
Hi, I am having a problem, where as django doesn't find the generics
module. Here is my urls.py

thanks in advance.

from django.conf.urls.defaults import *

from django.views.generic import *
from coltrane.models import Entry


entry_info_dict = {
'queryset': Entry.objects.all(),
'date_field': 'pub_date',
}

urlpatterns = patterns('',
(r'^$', 'django.generic.date_based.archive_index',entry_info_dict,
'coltrane_entry_archive_index'),
(r'^(?P\d{4})/$',
'django.generic.date_based.archive_year',entry_info_dict,
'coltrane_entry_archive_year'),
(r'^(?P\d{4})/(?P\w{3})/$',
'django.generic.date_based.archive_month',entry_info_dict,
'coltrane_entry_archive_month'),
(r'^(?P\d{4})/(?P\w{3})/(?P\d{2})/$',
'django.generic.date_based.archive_day',entry_info_dict,'coltrane_entry_archive_day'),

(r'^(?P\d{4})/(?P\w{3})/(?P\d{2})/(?P[-\w]+)/$',
'django.generic.date_based.object_detail',entry_info_dict,'coltrane_entry_detail'),
)


Gerald Klein DBA

contac...@geraldklein.com

www.geraldklein.com 

j...@zognet.com

708-599-0352


Linux registered user #548580

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



Re: startproject/startapp template context

2012-05-01 Thread Sam Simmons
This has turned into a topic for django developers.

On Tuesday, May 1, 2012 7:18:34 AM UTC-5, Sam Simmons wrote:
>
> Checked the src and it's the case that the 'any options' means the ones 
> available to the command. I could see an additional context option being 
> useful. I'm thinking a good way to go about this would be passing a path to 
> a config file that can be consumed by ConfigParser:
>
> django-admin.py startproject --template=/path/to/boilerplate 
> --template-context=options.conf myproject
>
> opions.conf:
> [options]
> compass
> coffee
> js_dir=javascripts
> css_dir=sass
>
> Only issue is ConfigParser expects a section header which isn't necessary 
> here...
>
> On Monday, April 30, 2012 10:39:56 PM UTC-5, Sam Simmons wrote:
>>
>> I was pretty excited to see the template option for 
>> startapp/startproject.
>>  
>> Especially when I read your context can be any option passed to the command 
>> and it clicked that the files are rendered using django's templating 
>> system. This could make for a really nice configurable boilerplate. But, 
>> after playing with it it looks like by any option they just meant the 
>> options available to the commands (django-admin.py help startapp/project).
>>
>> If that's the case, that's quite a bubble burst. Is there any way to pass 
>> in arbitrary context to the template? e.g.
>>
>> django-admin.py startproject --template=/path/to/boilerplate 
>> --compass=true --coffee=true myproject
>>
>> Or maybe a standard way to define a python dictionary and pass it in as 
>> the context:
>>
>> django-admin.py startproject --template=/path/to/boilerplate 
>> --template-context=config.py myproject
>>
>> Thanks!
>>
>

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



Re: Django admin site display (None) even when values are non-null/empty

2012-05-01 Thread Aditya Sriram M
Okay!! My bad.. was using the wrong function to fetch. Use fetchone() 
instead.

On Tuesday, 1 May 2012 07:22:11 UTC+5:30, Aditya Sriram M wrote:
>
>
>  I have been trying a lot but could not make out why it happens,
>
> class FortressUserAdmin(admin.ModelAdmin):
> list_display(. . . , get_my_schema)
> def get_my_schema(self, obj):
> sql_query = "select prop_val from customer_property where customer_id = 
> %d and property_value like 'SCHEMA'" % obj.customer_id.customer_id
> property_value = connection.cursor().execute(sql_query).fetch_one()   
>  
> print sql_query
> return 1
> # return "aditya"
> get_my_schema.short_description = 'Schema Instance'
>
>
>- why the column values are always (None) 
>- why the print 1 or print 'aditya' won't print anything to the console 
>
> Screen shot of the column admin site: [image: enter image description 
> here]
>

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



Re: Django timezone doesn't show the right time?

2012-05-01 Thread akaariai
On Apr 30, 11:03 pm, Dan Santos  wrote:
> Hi I'm a total programming newbie!
>
> ### INTRO ###
> I have been following this tutorial and the timezone outputs confuses
> me.https://docs.djangoproject.com/en/1.4/intro/tutorial01/#playing-with-...
>
> And I'm still confused after reading these explanations, I basically
> need some really dumbed down answers to understand this timezone
> business:
>
> TIME_ZONE setting: How does it 
> work?http://groups.google.com/group/django-users/browse_thread/thread/bebb...
>
> ### QUESTION ###
> * Europe/Brussels has UTC+2 during summer time.
>
> When I run this as I follow the Django tutorial, then the time (20:34)
> is behind by 2 hours to my local time and UTC displays +00:00.
> Shouldn't it display 22:34 +02:00 instead for a server located at
> Europe/Brussels?
>
> >>> Poll.objects.all()
>
> ]

Internally Django works in UTC . When you display a value in a
template or in a form it will be converted to the currently active
time zone (by default settings.TIMEZONE). So, when you just do
Poll.objects.all() you will see the UTC time, as this is Python
internal representation. If you would do {{poll.pub_date}} in the
template, it would be displayed in the time zone you have currently
active.

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



Getting checkbox value in controller

2012-05-01 Thread Larry Martell
I have a template that creates a text entry field and a checkbox. When
the checkbox is unchecked, the text field is disabled and cleared,
when it's checked, it's enabled, and the user may or may not have
typed in it. In my controller I need to distinguish between the 2
cases when the checkbox is unchecked, and then the checkbox is checked
but the text field is blank. I can get the value of the text field,
but not of the checkbox. Is there some way to do this? I've googled
this, and this has been asked a few times on stackoverflow, but none
of the solutions seem to work for me.

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



Re: startproject/startapp template context

2012-05-01 Thread Sam Simmons
Checked the src and it's the case that the 'any options' means the ones 
available to the command. I could see an additional context option being 
useful. I'm thinking a good way to go about this would be passing a path to 
a config file that can be consumed by ConfigParser:

django-admin.py startproject --template=/path/to/boilerplate 
--template-context=options.conf myproject

opions.conf:
[options]
compass
coffee
js_dir=javascripts
css_dir=sass

Only issue is ConfigParser expects a section header which isn't necessary 
here...

On Monday, April 30, 2012 10:39:56 PM UTC-5, Sam Simmons wrote:
>
> I was pretty excited to see the template option for 
> startapp/startproject.
>  
> Especially when I read your context can be any option passed to the command 
> and it clicked that the files are rendered using django's templating 
> system. This could make for a really nice configurable boilerplate. But, 
> after playing with it it looks like by any option they just meant the 
> options available to the commands (django-admin.py help startapp/project).
>
> If that's the case, that's quite a bubble burst. Is there any way to pass 
> in arbitrary context to the template? e.g.
>
> django-admin.py startproject --template=/path/to/boilerplate 
> --compass=true --coffee=true myproject
>
> Or maybe a standard way to define a python dictionary and pass it in as 
> the context:
>
> django-admin.py startproject --template=/path/to/boilerplate 
> --template-context=config.py myproject
>
> Thanks!
>

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



Re: ValueError: unknown locale: UTF-8

2012-05-01 Thread Timothy Makobu
Update:

When I downgraded to 1.3, everything worked ok. So I'll be using 1.3 for a
while now to avoid surprises.


On Sun, Apr 29, 2012 at 1:45 PM, Timothy Makobu  wrote:

> The database is PostgreSQL 9.1.3
>
>
>
> On Sun, Apr 29, 2012 at 1:09 PM, Timothy Makobu <
> makobu.mwambir...@gmail.com> wrote:
>
>> Hi,
>>
>> I'm getting an "unknown locale" exception and yet the LANG environment
>> variable is set:
>>
>> Traceback (most recent call last):
>>   File "manage.py", line 14, in 
>> execute_manager(settings)
>>   File
>> "/opt/local/lib/python2.7/site-packages/django/core/management/__init__.py",
>> line 459, in execute_manager
>> utility.execute()
>>   File
>> "/opt/local/lib/python2.7/site-packages/django/core/management/__init__.py",
>> line 382, in execute
>> self.fetch_command(subcommand).run_from_argv(self.argv)
>>   File
>> "/opt/local/lib/python2.7/site-packages/django/core/management/base.py",
>> line 196, in run_from_argv
>> self.execute(*args, **options.__dict__)
>>   File
>> "/opt/local/lib/python2.7/site-packages/django/core/management/base.py",
>> line 232, in execute
>> output = self.handle(*args, **options)
>>   File
>> "/opt/local/lib/python2.7/site-packages/django/core/management/base.py",
>> line 371, in handle
>> return self.handle_noargs(**options)
>>   File
>> "/opt/local/lib/python2.7/site-packages/south/management/commands/syncdb.py",
>> line 90, in handle_noargs
>> syncdb.Command().execute(**options)
>>   File
>> "/opt/local/lib/python2.7/site-packages/django/core/management/base.py",
>> line 232, in execute
>> output = self.handle(*args, **options)
>>   File
>> "/opt/local/lib/python2.7/site-packages/django/core/management/base.py",
>> line 371, in handle
>> return self.handle_noargs(**options)
>>   File
>> "/opt/local/lib/python2.7/site-packages/django/core/management/commands/syncdb.py",
>> line 110, in handle_noargs
>> emit_post_sync_signal(created_models, verbosity, interactive, db)
>>   File
>> "/opt/local/lib/python2.7/site-packages/django/core/management/sql.py",
>> line 189, in emit_post_sync_signal
>> interactive=interactive, db=db)
>>   File
>> "/opt/local/lib/python2.7/site-packages/django/dispatch/dispatcher.py",
>> line 172, in send
>> response = receiver(signal=self, sender=sender, **named)
>>   File
>> "/opt/local/lib/python2.7/site-packages/django/contrib/auth/management/__init__.py",
>> line 73, in create_superuser
>> call_command("createsuperuser", interactive=True, database=db)
>>   File
>> "/opt/local/lib/python2.7/site-packages/django/core/management/__init__.py",
>> line 150, in call_command
>> return klass.execute(*args, **defaults)
>>   File
>> "/opt/local/lib/python2.7/site-packages/django/core/management/base.py",
>> line 232, in execute
>> output = self.handle(*args, **options)
>>   File
>> "/opt/local/lib/python2.7/site-packages/django/contrib/auth/management/commands/createsuperuser.py",
>> line 70, in handle
>> default_username = get_default_username()
>>   File
>> "/opt/local/lib/python2.7/site-packages/django/contrib/auth/management/__init__.py",
>> line 105, in get_default_username
>> default_username = get_system_username()
>>   File
>> "/opt/local/lib/python2.7/site-packages/django/contrib/auth/management/__init__.py",
>> line 85, in get_system_username
>> return getpass.getuser().decode(locale.getdefaultlocale()[1])
>>   File "/opt/local/lib/python2.7/locale.py", line 503, in getdefaultlocale
>> return _parse_localename(localename)
>>   File "/opt/local/lib/python2.7/locale.py", line 435, in
>> _parse_localename
>> raise ValueError, 'unknown locale: %s' % localename
>> ValueError: unknown locale: UTF-8
>>
>>
>> # echo $LANG
>> # en_US.UTF-8
>>
>>
>

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



Re: html5 + Django

2012-05-01 Thread collectiveSQL
Thanks guys, both posts helped.

Cheers.

On Tuesday, 1 May 2012 01:51:08 UTC+8, HarpB wrote:
>
> It is much better to use Apache for static files than Django. You can 
> still run DJango for data validation, but all static content is typically 
> served via Apache. In your  virtualhost, you should proxy the /static/ 
> endpoint to the /static/ folder in Django app.
>
> On Sunday, April 29, 2012 5:39:15 AM UTC-7, collectiveSQL wrote:
>>
>> Hi Everyone, 
>>
>> I'm working on a heavily animated web site using the html5 canvas tag. 
>> Its mainly made of html, javascript and css static files and I'd like 
>> to integrate the Google Identity Toolkit for an Oauth 2.0 account 
>> chooser for signup and registration. 
>>
>> The first question is Django a good candidate for serving up mainly 
>> static files and using a small Django app for authentication? 
>>
>> And secondly what performance impact would this have over straight 
>> apache? 
>>
>> More info: 
>>
>> 1. Static web files such as html, javascript and css are stored on 
>> Amazon AWS S3 
>> 2. Data is loaded via oData using jsdata for animations 
>> 3. Amazon AWS EC2 is used to scale apache web servers 
>>
>> Thanks in advance.
>
>

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



Re: [JOB] Urgent - PHP/Python Developer needed

2012-05-01 Thread Cal Leeming [Simplicity Media Ltd]
Thanks to everyone for your feedback and to everyone who applied for the
position - we had some really great applicants, and one or two
exceptionally good ones.

The position has now been filled, but we will keep everyone who applied on
file for future ref.

I should also take the opportunity to mention that we have other openings
coming up in the next few months which are purely Python/Django based - and
we are also considering taking on interns this year.

Cal


** **
>
> *From:* django-users@googlegroups.com [mailto:
> django-users@googlegroups.com] *On Behalf Of *Cal Leeming [Simplicity
> Media Ltd]
> *Sent:* Thursday, April 12, 2012 3:28 PM
> *To:* django-users@googlegroups.com
> *Subject:* Re: [JOB] Urgent - PHP/Python Developer needed
>
> ** **
>
> Further update on this - budget has changed so, we can now offer a higher
> rate and a part time alternative.
>
> ** **
>
> * 1500$/month for 70 hours (20$/hour)
>
> * 2000$/month for 100 hours (20$/hour)
>
> ** **
>
> Thanks
>
> ** **
>
> Cal
>
> On Tue, Apr 10, 2012 at 9:31 PM, Cal Leeming [Simplicity Media Ltd] <
> cal.leem...@simplicitymedialtd.co.uk> wrote:
>
> Hi all,
>
> ** **
>
> Another urgent position has come up in our company, applicant needs to
> have some experience with using Django but must also be comfortable with
> PHP (our clients are a 50/50 split between PHP and Django).
>
> ** **
>
> --
>
> ** **
>
> Simplicity Media Ltd are an established UK company providing bespoke IT
> solutions for a variety of clients across the globe.
>
> We are currently looking for a flexible and diverse developer to maintain
> and extend our existing PHP deployments.
>
> Our solutions are high volume (peaking at around 5000 requests/minute),
> with extremely large databases (400 million+ rows) and large content
> servers (15TB+ of media files).
>
> The successful candidate should have at least 2 years commercial
> experience, be fluent OOP, and have a general understanding of what it
> means to be a good programmer.
>
> We're looking for a real person with real emotion, not a corporate robot -
> and being a team player is absolutely critical. Our company attitude is
> firm but fair, we encourage a healthy mixture of fun/work, and we even have
> a 'NSFW' IRC channel!
>
> Essential skills:
> * PHP 5.x (OOP)
> * MySQL
> * Linux (Debian)
> * Bash (shell/ssh etc)
>
> Desired (non-essential) skills:
> * MongoDB
> * Redhat
> * Percona
> * Memcache
> * Redis
> * Python
>
> Desired (non-essential) experience:
> * CodeIgniter (PHP)
> * TubeX (PHP)
> * Django (Python)
> * JIRA (Atlassian)
> * Basecamp
> * Zendesk
> * Livechat
>
> MINIMUM CRITERIA:
> * MUST be able to work on either EST or GMT+0 timezone
> * MUST be able to work 30+ hours a week.
> * MUST be comfortable working on 18+ sites.
> * MUST be fluent in written & spoken English
>
> The position is full time, offering around $2000/month (roughly
> £1200/month) for the right candidate - price/hours are negotiable.
>
> This position MUST be filled by 15th April 2012.
>
> When applying, please also include a cover note explaining why you feel
> you would be suitable for this role.
>
> ** **
>
> ** **
>
> --
> 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+unsubscr...@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+unsubscr...@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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: HELP with unicode!!!!!

2012-05-01 Thread Alexandr Aibulatov
Write at first line on your py file:
# -*- coding: utf-8 -*-

2012/5/1 dizzydoc :
> Hi ,
>
> i have lost a lot of time looking for a solution.
>
> My problem is, while i a reading csv in python using
>
> csv_file  = open(path_file, "rb")
> reader = csv.reader(csv_file)
>
> whenever i perform any operation on the string returned in each cell i
> get this error
>
> *** UnicodeEncodeError: 'ascii' codec can't encode character u'\xa0'
> in position 34: ordinal not in range(128)
>
> i tried decoding the value as
>
> val.decode('utf-8')
>
> ...this helped to reduce a few encodings but gets stuck for
> the encoding "\xa0"
> Please HELP!
>
> 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+unsubscr...@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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



HELP with unicode!!!!!

2012-05-01 Thread dizzydoc
Hi ,

i have lost a lot of time looking for a solution.

My problem is, while i a reading csv in python using

csv_file  = open(path_file, "rb")
reader = csv.reader(csv_file)

whenever i perform any operation on the string returned in each cell i
get this error

*** UnicodeEncodeError: 'ascii' codec can't encode character u'\xa0'
in position 34: ordinal not in range(128)

i tried decoding the value as

val.decode('utf-8')

...this helped to reduce a few encodings but gets stuck for
the encoding "\xa0"
Please HELP!

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



startproject/startapp template context

2012-05-01 Thread Sam Simmons
I was pretty excited to see the template option for 
startapp/startproject.
 
Especially when I read your context can be any option passed to the command 
and it clicked that the files are rendered using django's templating 
system. This could make for a really nice configurable boilerplate. But, 
after playing with it it looks like by any option they just meant the 
options available to the commands (django-admin.py help startapp/project).

If that's the case, that's quite a bubble burst. Is there any way to pass 
in arbitrary context to the template? e.g.

django-admin.py startproject --template=/path/to/boilerplate --compass=true 
--coffee=true myproject

Or maybe a standard way to define a python dictionary and pass it in as the 
context:

django-admin.py startproject --template=/path/to/boilerplate 
--template-context=config.py myproject

Thanks!

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



serving client uploaded files

2012-05-01 Thread Nenad Cikic
Hello,
how can i serve the file uploaded files (images)? What I mean I have few 
model with images, and I see images in the change form.
The problem is that I can see the same images by writing directly the media 
path in the web address. And since the model is designed to have data split 
between the users I do not want the images to be seen that way.
I have looked and found
https://docs.djangoproject.com/en/dev/howto/static-files/?from=olddocs#staticfiles-other-directories
What I have done is to add to the url the following
url(r'^media/(?P.*)$', "registracija.views.myuploadedfileview", 
{'document_root': settings.MEDIA_ROOT,}),

and then the view is something as:
  #parse the request and try to undestand if the image is mine 
  if yes:
 return serve(request, path, document_root, show_indexes)
  else:
 return HttpResponseNotFound()

This is working; what bothers me is that the serve function is, as in docs, 
stated to be used only in development. 
But if I serve the images directly by the web server, would I bypass my 
security checks?
Is there any other way to achieve my means?
Thanks
Nenad

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