Re: Operate with Postgresql from Django views.

2009-12-21 Thread Nicu Marcu
Yes, this was the problem, thanks for your help. 2009/12/21 Christophe Pettus > > On Dec 21, 2009, at 1:34 AM, NMarcu wrote: > > Everything is OK, if the view is finished, but if after this line I > > add an infinite loop, and in this time I check that table from console > >

Re: Custom Django-Admin commands

2009-12-21 Thread Justin Steward
On Tue, Dec 22, 2009 at 3:51 PM, Alex_Gaynor wrote: > > Do you have __init__.py files in each of those directories? Of course - Else it woud not work from the project's root directory either. ~Justin -- You received this message because you are subscribed to the Google

Re: Custom Django-Admin commands

2009-12-21 Thread Alex_Gaynor
On Dec 21, 8:38 pm, Justin Steward wrote: > On Tue, Dec 22, 2009 at 12:16 PM, Doug Blank wrote: > > > You probably just need to set your PYTHONPATH: > > > cd /home/user > > PYTHONPATH=proj python proj/manage.py custom > > That was my initial thought

Re: One thing to add to 0.96 to 1.0 porting guide

2009-12-21 Thread Karen Tracey
On Mon, Dec 21, 2009 at 10:19 PM, Russell wrote: > http://docs.djangoproject.com/en/dev/releases/1.0-porting-guide/ > > The guide didn't mention the change in > django.datastructure.MultiValueDict which affects QueryDict directly > and request.POST and request.GET eventually.

One thing to add to 0.96 to 1.0 porting guide

2009-12-21 Thread Russell
http://docs.djangoproject.com/en/dev/releases/1.0-porting-guide/ The guide didn't mention the change in django.datastructure.MultiValueDict which affects QueryDict directly and request.POST and request.GET eventually. The change is minor, but critical: MultiValueDict.iteritems() returns (key,

Re: Custom Django-Admin commands

2009-12-21 Thread Justin Steward
On Tue, Dec 22, 2009 at 12:16 PM, Doug Blank wrote: > > You probably just need to set your PYTHONPATH: > > cd /home/user > PYTHONPATH=proj python proj/manage.py custom > That was my initial thought too, however setting the PYTHONPATH does not affect the behaviour in this

Re: Custom Django-Admin commands

2009-12-21 Thread Doug Blank
On Mon, Dec 21, 2009 at 8:10 PM, Justin Steward wrote: > Hi all, > > I've written a custom command to use with manage.py, and from the root > of the project directory, it works great. > > But the problem is, this command is almost never going to be called > from within the

Custom Django-Admin commands

2009-12-21 Thread Justin Steward
Hi all, I've written a custom command to use with manage.py, and from the root of the project directory, it works great. But the problem is, this command is almost never going to be called from within the project directory. (hoping the spacing doesn't get too mangled when I send this) /home/

Does Django support sockets of type SOCK_STREAM for full-duplex communication with a client?

2009-12-21 Thread Chris
Hello, I have a client that needs to constantly send data to Django-based backend. The client code follows the pattern: ... s = socket.socket( socket.AF_INET, socket.SOCK_STREAM ) s.connect( ( '10.20.30.40', 8080 ) ) while True : data = s.recv( 2048 ) print data s.send(

Re: Binary Post Data to ImageField

2009-12-21 Thread 邓超
As I know Django can not save binary data with it's default orm, you can try to select another orm like sqlalchemy, or you can try to modify the orm to make it can save binary data. 2009/12/21 Markus T. > Hi, > > I'm trying to save binary POST data to an ImageFile

Re: Best way to handle class attribute as a space separated string?

2009-12-21 Thread Margie Roginski
Ok, well just thought maybe I was missing some python builtin or django method that others were using. Looks like it's just something that needs be coded up and encapsulated. Thanks for your comments! Margie On Dec 21, 2:03 pm, Kieran Brownlees wrote: > Not very

Re: Hashed, salted mysql password in settings.py, reccomendation to protect information

2009-12-21 Thread fruity
Sorry again, even better: http://code.djangoproject.com/wiki/SplitSettings fruity wrote: > Thank you very much. > > After a while of searching on django-snippets there was the answer :) > > http://www.djangosnippets.org/snippets/94/ > > Brice Leroy wrote: >> Easy, >> put your password in a

Re: Hashed, salted mysql password in settings.py, reccomendation to protect information

2009-12-21 Thread fruity
Thank you very much. After a while of searching on django-snippets there was the answer :) http://www.djangosnippets.org/snippets/94/ Brice Leroy wrote: > Easy, > put your password in a settings_secret.py file, do not import this > file on your repository. Add: > from settings_secret import

Re: Hashed, salted mysql password in settings.py, reccomendation to protect information

2009-12-21 Thread Brice Leroy
Easy, put your password in a settings_secret.py file, do not import this file on your repository. Add: from settings_secret import mysql_password ... you're set :) Brice 2009/12/21 fruity : > Hello, > > I'd like to protect the mysql password that is in settings.py > > I

Re: super() argument 1 must be type, not None

2009-12-21 Thread TiNo
On Tue, Dec 22, 2009 at 00:19, Kieran Brownlees wrote: > Have you restarted your server lately? I find that bug turns up from > time to time when the auto reloader doesn't reload properly. > Yep. Also tried in the dev server as mentioned... -- You received this message

Re: Enable users to input formatted text

2009-12-21 Thread Continuation
django-tinymce looks like is what I need. Thanks for pointing me to that. On Dec 21, 5:50 pm, "pjrhar...@gmail.com" wrote: > You've got to decide what you want to allow. If the users are trusted > you could allow them to input HTML, then you have to make sure its > marked

Re: super() argument 1 must be type, not None

2009-12-21 Thread Kieran Brownlees
Have you restarted your server lately? I find that bug turns up from time to time when the auto reloader doesn't reload properly. Kieran On Dec 22, 12:17 pm, TiNo wrote: > Hi, > > I am overriding a save function of a model with the following code: > >     def save(self, *args,

super() argument 1 must be type, not None

2009-12-21 Thread TiNo
Hi, I am overriding a save function of a model with the following code: def save(self, *args, **kwargs): if (not self.id) and self.email != '': self.create_user() if hasattr(self, 'user'): self.user.email = self.email self.user.first_name =

Re: Enable users to input formatted text

2009-12-21 Thread pjrhar...@gmail.com
You've got to decide what you want to allow. If the users are trusted you could allow them to input HTML, then you have to make sure its marked as safe so the HTML is not escaped.[1] Alternatively you could use a markup language that can be converted to HTML.[2] If you just want the newlines,

Re: Best way to handle class attribute as a space separated string?

2009-12-21 Thread Shawn Milochik
I'd use a dictionary or list. If it has to persist, use simplejson to serialize it and create a couple of functions to wrap the JSON stuff. Then you can use property() to simplify it further. Shawn -- You received this message because you are subscribed to the Google Groups "Django users"

Best way to handle class attribute as a space separated string?

2009-12-21 Thread Margie Roginski
I have a variety of places in my code where I add a class to a widget. For example, I have a render() function for a DateWidget that contains this code, which adds a special class if the date is in the past. if date < datetime.datetime.now(): if

Re: authentication security

2009-12-21 Thread macdd
On Dec 21, 10:35 am, Eric Chamberlain wrote: > On Dec 18, 2009, at 7:58 PM, macdd wrote: > > > I am reading the django book. I just finished the chapter on > > authentication. I get the jist of it. What I don't understand is the > > overall security of authentication. If everything

Re: Overhead of using django.contrib.markup vs. pre-rendered HTML field

2009-12-21 Thread Jesaja Everling
Hi Brian, thanks for your reply! It's true that this is probably mostly a matter of personal preference/ application needs, but I agree with you that it's a good deal nowadays to trade a little bit of disk-space for some processing power. Best Regards, Jesaja Everling On 21 Gru, 18:33, Brian

Hashed, salted mysql password in settings.py, reccomendation to protect information

2009-12-21 Thread fruity
Hello, I'd like to protect the mysql password that is in settings.py I read in the django docs that is possible to use SHA1 hashes as password for mysql and I've tried using mysql to salt and hash the password but still if I would have my project on a public svn|git repository anyone could just

Re: Operate with Postgresql from Django views.

2009-12-21 Thread Christophe Pettus
On Dec 21, 2009, at 1:34 AM, NMarcu wrote: > Everything is OK, if the view is finished, but if after this line I > add an infinite loop, and in this time I check that table from console > for the new record, that is not there. This sounds like a transaction issue. In the standard Django

Re: authentication security

2009-12-21 Thread Eric Chamberlain
On Dec 18, 2009, at 7:58 PM, macdd wrote: > I am reading the django book. I just finished the chapter on > authentication. I get the jist of it. What I don't understand is the > overall security of authentication. If everything you do is passed as > plain text then it isn't very secure. Okay so

Re: Overhead of using django.contrib.markup vs. pre-rendered HTML field

2009-12-21 Thread Brian Neal
On Dec 21, 7:12 am, Jesaja Everling wrote: > Hi All! > > I'm wondering how expensive it is in terms of processing power to use > the django.contrib.markup filters for displaying blog posts instead of > storing pre-rendered HTML in a db field. > The Pinax blog application

Need Google Appengine - Django - Facebook (pyFacebook) Advice

2009-12-21 Thread Kaan Soral
Hello; I currently develop Facebook applications with Php, the need for a scalable platform and the charm to use a decent framework led me to learn Appengine, after experimenting a little bit with webapp framework and not being able to use pyFacebook lib with webapp, I decided I should learn

Re: Is this right: Modifying the admin changelist?

2009-12-21 Thread Daniel Roseman
On Dec 21, 4:40 pm, yummy_droid wrote: > Anyone have advice on this? Not really. Your solution is probably the best that can be done - it does involve instantiating the ChangeList twice, but that's pretty much unavoidable. One of the main criticisms a lot of people have of the

Problem importing datetime from xml

2009-12-21 Thread bax...@gretschpages.com
I'm importing data from xml using xmltramp. Among the data are a bunch of times formatted like so: 2010-05-15 00:00:00 When I import that, I'm getting Enter a valid date/time in -MM-DD HH:MM[:ss[.uu]] format. I've tried altering the formatting, but I'm just not getting these

Django-based journal publishing system

2009-12-21 Thread Fabio Natali
Hi everybody. --- In short: Do you know of any Django-based alternatives to "Open Journal Systems" [0]? --- --- In details: I want to publish a magazine on the internet, say 3 or 4 issues per year. The publishing process will be collaborative, there will be several users involved, each user

Re: Is this right: Modifying the admin changelist?

2009-12-21 Thread yummy_droid
Anyone have advice on this? On Dec 20, 2:54 am, yummy_droid wrote: > Hi, > > I wanted a "sum" of a particular column being listed in theadminlist > page. I looked it up and did it the following way. Is this the correct > way of doing it? > > I modified theadmin.py to do the

Re: Logout and session

2009-12-21 Thread David De La Harpe Golden
On Mon, Dec 21, 2009 at 12:52:24PM -0200, Victor Loureiro Lima wrote: > Well, template caching invalidates view cache right? Plus, my understanding > of the template cache is that > it will hit my view, do all the DB stuff, but skip the template processing > which takes a while to finish, is my

Re: Cron vs event triggered action

2009-12-21 Thread David De La Harpe Golden
On Sat, Dec 19, 2009 at 06:28:23AM -0800, Tim Daniel wrote: > David, Celery sounds really good, thanks for the tip, I'll have a > deeper look into it as soon as I've got some time, if I can't get it > one question: Is it capable of running on every web server > that supports Python? Well, it's

Re: Logout and session

2009-12-21 Thread Victor Loureiro Lima
2009/12/21 David De La Harpe Golden > On Thu, Dec 17, 2009 at 03:54:02PM -0200, Victor Loureiro Lima wrote: > > Okay, let me further explain my problem... > > > > My website depends heavilly on the caching system, I'm using cache_page > to > > cache my view (

Re: FeedMagnet: New Django-powered website just launched

2009-12-21 Thread pabloi
Great thanks for the response. I was wondering mostly cause we are using Amazon infrastructure, which is by the way amazing, but is always good to consider alternatives. - Pablo On Dec 17, 6:00 pm, Jason Ford wrote: > Thanks! My comparison of Django and Ruby on Rails was

Re: Logout and session

2009-12-21 Thread David De La Harpe Golden
On Thu, Dec 17, 2009 at 03:54:02PM -0200, Victor Loureiro Lima wrote: > Okay, let me further explain my problem... > > My website depends heavilly on the caching system, I'm using cache_page to > cache my view ( using memcached backend ), > however I have the "Hello, " on top of every page when

Re: format date output in mail form

2009-12-21 Thread rvandam
@Guilherme Cavalcanti I haven't thought of using a template for the mail. That will be my next approach for this problem. Thank you for this. For now I have this in my model: Aankomst = form.cleaned_data['Aankomst'] aankomst = str(Aankomst)

Re: how do you get recordcount?

2009-12-21 Thread Shawn Milochik
Add this line to that code: print dir(tms) I think you'll find a method of the recordset that will give you the count. I don't remember off of the top of my head. Why are you doing a direct SQL query instead of using a queryset from your model? Shawn -- You received this message because

Re: how do you get recordcount?

2009-12-21 Thread Jason Beaudoin
On Mon, Dec 21, 2009 at 9:02 AM, Bobby Roberts wrote: >    Looking at this code: > >    newsqlcmd="select title,author from booklist" >    cursor=connection.cursor() >    cursor.execute (newsqlcmd) >    tms=cursor.fetchall()  #this is the actual recordset being pushed > back

how do you get recordcount?

2009-12-21 Thread Bobby Roberts
Looking at this code: newsqlcmd="select title,author from booklist" cursor=connection.cursor() cursor.execute (newsqlcmd) tms=cursor.fetchall() #this is the actual recordset being pushed back to the template how can I get the record count? I could loop through and

Re: format date output in mail form

2009-12-21 Thread Guilherme Cavalcanti
Take a look: template = get_template("email/notification.html") ctx = Context({'title': self.title, 'update_account_link': "#", 'update_km_link': "#", 'date': datetime.now(), 'user': self.user_profile.user.username, 'text': self.text, 'aviseme_link': "#",

Re: format date output in mail form

2009-12-21 Thread Guilherme Cavalcanti
Hello, can you show how date is being printed? Maybe if you try to create an "template" using {{ date|date:"j N \d\e Y" }} (or what else format you want) and just call render passing an context with the datetime object. On Dec 21, 9:26 am, rvandam wrote: > I found some

Overhead of using django.contrib.markup vs. pre-rendered HTML field

2009-12-21 Thread Jesaja Everling
Hi All! I'm wondering how expensive it is in terms of processing power to use the django.contrib.markup filters for displaying blog posts instead of storing pre-rendered HTML in a db field. The Pinax blog application makes use of these markup-filters to render HTML on the fly, for example. I

Re: format date output in mail form

2009-12-21 Thread rvandam
I found some date formatting in forms/fields.py, forms/widgets.py and in contrib/localflavor/generic/forms.py. I tried if small modifications resulted in a different output, but nothing worked. I also tried to change the local setting in settings.py. Is there a way to modify the date ouptut

ckfinder with django

2009-12-21 Thread Alessandro Ronchi
Has someone managed to use ckfinder with django ? I want only staff users of my apps to be able to upload files, is it possible? -- Alessandro Ronchi http://www.soasi.com SOASI - Sviluppo Software e Sistemi Open Source http://hobbygiochi.com Hobby & Giochi, l'e-commerce del divertimento --

Re: pass to a template many querysets

2009-12-21 Thread rebus_
2009/12/21 Francesco Benincasa : > Hi all, > I need to pass to a template more than one list of diffent models objects. > > Now I'm using a date_based.archive_index but I can pass it only a queryset as > argument, isn't it? > > What's the correct approach? To try to pass

Re: Enable users to input formatted text

2009-12-21 Thread BobAalsma
Umm, I think you would then also invite/enable hackers to upload unwanted thingies, such as viruses and scripts... On Dec 21, 8:12 am, Continuation wrote: > I have a TextField() field that stores user entered text. However the > formatting is a bit weird, eg. new lines

pass to a template many querysets

2009-12-21 Thread Francesco Benincasa
Hi all, I need to pass to a template more than one list of diffent models objects. Now I'm using a date_based.archive_index but I can pass it only a queryset as argument, isn't it? What's the correct approach? To try to pass in a same queryset all objects I need (and in this case, how?) or I can

Binary Post Data to ImageField

2009-12-21 Thread Markus T.
Hi, I'm trying to save binary POST data to an ImageFile field - so far with no satisfying success. I can't seem to convince the client (Flex based image editor) to send binary data as correct "multipart/form-data"; I only have the option to send as raw binary data or with POST variables. My

passing additional parameters to custom form fields

2009-12-21 Thread druzhinin
hi folks, I am trying to create a custom form field, that is based on MultipleChoicefield. it populates itself from database and displays a nice multi-checkbox table for multiple photos selection for adding them to article... I've run into problems when trying to process 'initial' inside

Operate with Postgresql from Django views.

2009-12-21 Thread NMarcu
Hello, I have a problem, or I don't know how is working. I want to do an operation to a table, on Postgresql database. By example: I want to add new data in a table. I do it like this: ob_device = Device(id=device_address) ob_device.save() Everything is OK, if the view is finished,