How to deal with NULL value in template

2009-12-17 Thread Continuation
I have a field with the null=True option How do I test for the Null value in template? I did something like: {% ifequal field Null %} do something {% else %} do something else I tested it and it worked. But I want to make sure this is the proper way to handle Null value in Django. The d

InternalError -- django specific state?

2009-12-17 Thread shaunc
Can anyone help me with the following point? Does django keep internal state when psycopg throws a OperationalError, and how do I clear it? The situation is this: I have external processes writing into a django/ postgres database. To avoid using semaphors, etc, I'm trying to use a row level lock

Re: Displaying Calculated Values in Django Admin

2009-12-17 Thread Streamweaver
Thanks for the reply. I'm still working with this and have it working in cases of editing records but when I try to create a new record it throws an error as would be expected since there's no instance to read the initial values from. I tried putting an is_bound check to give a devault but of cou

Re: Apache Environment Variables

2009-12-17 Thread Graham Dumpleton
On Dec 18, 3:57 pm, Info Cascade wrote: > Dan, > > This works for me -- using mod_python. > > VirtualHost defininition:> SetEnv VIRTUAL_HOST_NAME dev.hostname.com > >     SetEnv DATABASE_NAME dbname > settings.py: > > VIRTUAL_HOST_NAME = os.environ.get('VIRTUAL_HOST_NAME') > > DATABASE_NAME = os

Re: Apache Environment Variables

2009-12-17 Thread Info Cascade
Dan, This works for me -- using mod_python. VirtualHost defininition: > SetEnv VIRTUAL_HOST_NAME dev.hostname.com > SetEnv DATABASE_NAME dbname settings.py: > VIRTUAL_HOST_NAME = os.environ.get('VIRTUAL_HOST_NAME') > DATABASE_NAME = os.environ.get('DATABASE_NAME') Liam Dashdrum wrote: > I'm

Re: Issue with ManyToMany Relationships not updating inmediatly after save

2009-12-17 Thread Ariel Nunez
Diego, Which version of Django are you using? I remember a refactor of m2m landed recently as part of Alex's GSoC project. [1] Just my 2 Colombian Pesos. [1] http://www.pubbs.net/django/200910/58391/ On Thu, Dec 17, 2009 at 5:51 PM, Diego Andrés Sanabria Martin (diegueus9) < diegue...@gmail.co

Re: Error message

2009-12-17 Thread Andres Vargas - zodman
its because you set DEBUG=False and on your templates dir not exist the file 500.html On Thu, Dec 17, 2009 at 7:34 PM, reactosguy wrote: > I get this message every time I go on http://localhost:8000/ with the > Django server running: > > Traceback (most recent call last): > >  File "C:\Python26\

Error message

2009-12-17 Thread reactosguy
I get this message every time I go on http://localhost:8000/ with the Django server running: Traceback (most recent call last): File "C:\Python26\lib\site-packages\django\core\servers \basehttp.py", line 279, in run self.result = application(self.environ, self.start_response) File "C:\Py

Re: LDAP-groups problem

2009-12-17 Thread Mike Dewhirst
Wayne wrote: > Hi, > > I tried to use djando-ldap-groups but got some errors from database > configuration. Could somebody shed some light on the possible problems > of my set up? > Maybe the Oracle API is translating the PK into a LOB? If LOB is a large object then that is probably the issue

LDAP-groups problem

2009-12-17 Thread Wayne
Hi, I tried to use djando-ldap-groups but got some errors from database configuration. Could somebody shed some light on the possible problems of my set up? Thanks, Our LDAP server is Sun One Server and the site is running in the windows environment. The settings.py file: LDAP_SERVER = 'directo

Re: Python 2.6 Decompile --- I lost my views.py but have the views.pyc

2009-12-17 Thread Fabian Ezequiel Gallina
2009/12/17 Andrew : > Thanks guys for all the commentsIm on ubuntu on eclipse and there > was no local history alas > > Thems the breaks when you omit to submit ;-) ... to source control... > > I used UnPyc to disassemble the .pyc and I am now rewriting the python > using the assembly as a

Re: Save file object to FileField

2009-12-17 Thread Brian S
I found the answer in this discussion: http://groups.google.com/group/django-users/browse_frm/thread/184e5e09db1efce4/7816cbc650d8dc77 Pass in the filename and content to the FileField's save() method directly, rather than using the model instance's save() method. On Dec 14, 2:24 pm, Brian S wr

Re: Django Settings File - Where is it?

2009-12-17 Thread D. Rick Anderson
Make sure you started a project first: django-admin.py startproject myapp cd myapp vi settings.py On Thu, Dec 17, 2009 at 4:01 PM, reactosguy wrote: > Where is the Django settings file? I read the docs but I am confused. > > -- > > You received this message because you are subscribed to the Goo

Re: Django Settings File - Where is it?

2009-12-17 Thread dartdog
In your root dir for your Django project normally. settings.py Not in the django root if that is your confusion On Dec 17, 6:01 pm, reactosguy wrote: > Where is the Django settings file? I read the docs but I am confused. -- You received this message because you are subscribed to the Google Gro

Django Settings File - Where is it?

2009-12-17 Thread reactosguy
Where is the Django settings file? I read the docs but I am confused. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users

Re: Python 2.6 Decompile --- I lost my views.py but have the views.pyc

2009-12-17 Thread Andrew
Thanks guys for all the commentsIm on ubuntu on eclipse and there was no local history alas Thems the breaks when you omit to submit ;-) ... to source control... I used UnPyc to disassemble the .pyc and I am now rewriting the python using the assembly as a guide. Good think I did mainfram

Issue with ManyToMany Relationships not updating inmediatly after save

2009-12-17 Thread diegueus9
Hi, I'ḿ having issues with ManytoMany Relationships that are not updating in a model when I save it (via the admin) and try to use the new value within a function attached to the post_save signal or within the save_model of the associated AdminModel. I've tried to reload the object within those fu

Re: Help: Should I use Admin site for everything?

2009-12-17 Thread Sid
There are some audit trail stuff available for Django http://code.google.com/p/fullhistory/ http://code.djangoproject.com/wiki/AuditTrail -Sid -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@g

TemplateSyntaxError: 'property' object is not iterable

2009-12-17 Thread Chris Curvey
I have my class definition that looks like class Foo: def get_bars(self): bars = [] # do something to collect bar instances return bars bars = property(get_bars) in my template, I'd like to do something like this: {% for bar in foo.bars %} {{bar.snafu}} {% endfor %}

Re: FeedMagnet: New Django-powered website just launched

2009-12-17 Thread Jason Ford
Thanks! My comparison of Django and Ruby on Rails was definitely more subjective than objective. Although I read several good articles that had more objective metrics to compare Ruby and Python speed, I did not run those kinds of tests myself. My approach was more about gathering the information th

Re: Python 2.6 Decompile --- I lost my views.py but have the views.pyc

2009-12-17 Thread Bill Freeman
The name of the byte code disassembler is dis, and it's part of the standard python install in 2.4, 2.5, 2.6, and 3.0 (the ones I have handy to test with) and will be documented in the default docs. You can confirm that you have it by trying "import dis". On Thu, Dec 17, 2009 at 2:45 PM, Shawn Mi

Re: Python 2.6 Decompile --- I lost my views.py but have the views.pyc

2009-12-17 Thread Shawn Milochik
This won't help you unless there's something you forgot about, but it could help you in the future. In addition to git, I also use JungleDisk. It backs up my entire projects folder every hour. Perhaps you have Carbonite, JungleDisk, Mozy, or one of those services and you might be able to recover

Re: Python 2.6 Decompile --- I lost my views.py but have the views.pyc

2009-12-17 Thread Sean Perry
On Thu Dec 17 11:28 , Bill Freeman sent: >I saw a demo of a byte code disassembler once. It won't get you the >source code back, but you could conceivably construct equivalent from >it. You can, for example, see what it's calling, and sketch out the >contiditionals and any loops. You could g

Re: Python 2.6 Decompile --- I lost my views.py but have the views.pyc

2009-12-17 Thread Bill Freeman
I saw a demo of a byte code disassembler once. It won't get you the source code back, but you could conceivably construct equivalent from it. You can, for example, see what it's calling, and sketch out the contiditionals and any loops. You could google for it, or ask on the python tutor mailing

Re: Apache Environment Variables

2009-12-17 Thread Dashdrum
Thanks to both responders for the explanations. Dan -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@goog

Python 2.6 Decompile --- I lost my views.py but have the views.pyc

2009-12-17 Thread Andrew
Hi guys, Ok...firstly me bad ... I didn't check into my source control which was stupid. So if I can close that book ;-) I am looking for a decompiler for my views.pyc ... Im using django 1.1.1 and python 2.6.2 ... I have tried UnPyc but fails. Has anyone successfully found a 2.6 decompiler ? Th

Development server exiting after entering login info in admin site

2009-12-17 Thread Pascal Vincent
Hello, I'm new to django, and am just going through the tutorial (on Mac Os X 10.4.11, installed latest stable version from tarball). All seems to go well until I enter the damin login nd passwd, after which the development server just exits without notice. I've traced this back to autoreload.py

Re: Logout and session

2009-12-17 Thread Victor Loureiro Lima
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 the user is logged, thus I cant just cache everything. So I began experimenting

Need help inserting pdf

2009-12-17 Thread Megan
I know this is VERY basic, but I am NOT a programmer or web designer - I am just trying to maintain and update the site. I am having a problem inserting/editing a pdf to the site. It's a basic pdf, no report generation, etc. I am trying to insert the pdf to a flat page in the: General Image/URL

Root url returning 302 FOUND

2009-12-17 Thread Kegan Gan
In my root urls.py I have the following: urlpatterns = patterns('', (r'^', include('story.urls')), ) In my story app, I have the following urls.py: urlpatterns = patterns('', url(r'^$', home_view, name='story-home'), url(r'^create/$', home_view, name='story-create'), ) Running on th

Re: Logout and session

2009-12-17 Thread David De La Harpe Golden
Victor Loureiro Lima wrote:. > auth system is in fact invalidating my current session id cookie, but > afterwards it sets a new session id cookie, why does it do that? > Um. So that anonymous users of your site still have sessions? Django supports "anonymous sessions", sessions and auth are diffe

Re: Django ugettext() got an unexpected keyword argument 'default' (template error)

2009-12-17 Thread Ian
On Dec 16, 9:47 pm, mtnpaul wrote: > I'm not looking for an answer, just thought I would post this problem > so if someone else gets it they'll have one place to look anyways. > > I had a model with some field names greater than 31 characters. Since > most databases restrict column name length to

Re: Django editor for Debian

2009-12-17 Thread Javier Guerra
On Thu, Dec 17, 2009 at 10:12 AM, Wiiboy wrote: > I like to use Kate (KDE's default text editor).  It has auto-indent, > and syntax highlighting for Python, and Django templates. another vote for Kate, and the best part is that it's a KPart, so the same engine can be used right within the file br

Re: Django editor for Debian

2009-12-17 Thread Wiiboy
I like to use Kate (KDE's default text editor). It has auto-indent, and syntax highlighting for Python, and Django templates. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To

Logout and session

2009-12-17 Thread Victor Loureiro Lima
I have a question about django's session/auth system and its logout method. Whenever I want to invalidate a user session ( i.e.: calling auth.logout(request)), django auth system is in fact invalidating my current session id cookie, but afterwards it sets a new session id cookie, why does it do tha

Re: FeedMagnet: New Django-powered website just launched

2009-12-17 Thread pabloi
Hi Jason, the site looks very nice. I also found your blog posting regarding Django vs Ruby very interesting, if I may ask, did you make some metrics to determine how faster Python can be over Ruby? Also, this might be a lot to ask but ... what kind of infrastructure do you use to support your sit

Re: Caching pages that take a long time to generate

2009-12-17 Thread Tom Evans
On Thu, Dec 17, 2009 at 12:58 PM, Ales Zoulek wrote: > >> The entire point of using a generator driven response is to avoid >> blocking until the entire response is generated, so going through the >> response.content property would not be useful. >> > > Using your patch the respose will be blockin

Re: FeedMagnet: New Django-powered website just launched

2009-12-17 Thread Jason Ford
Let's see. We started on the Django version in mid-October...so right at 2 months from first code until now. Luke had used Django on a few projects before this one, but the past two months have been my introduction to Django. I really like it - especially compared with some of the PHP frameworks I

Re: Django editor for Debian

2009-12-17 Thread roberto
Ulipad: it is light, it has nice features, it is developed with pythonwhat else ? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email

Humble-structure sites on Django // Suggestion needed

2009-12-17 Thread tezro
Hello everyone. Making well-structured websites on Django is a very comprehensive process. All these blogs, news, user-related stuff - easy. But what about, say, corporate website? I mean I got a project to do, thought it would be great to base it on Django as usual, but... Look at the structure,

Re: Caching pages that take a long time to generate

2009-12-17 Thread Karen Tracey
On Thu, Dec 17, 2009 at 7:58 AM, Ales Zoulek wrote: > > The entire point of using a generator driven response is to avoid >> blocking until the entire response is generated, so going through the >> response.content property would not be useful. >> >> > Using your patch the respose will be blockin

Re: Caching pages that take a long time to generate

2009-12-17 Thread Ales Zoulek
> The entire point of using a generator driven response is to avoid > blocking until the entire response is generated, so going through the > response.content property would not be useful. > > Using your patch the respose will be blocking as well. The block wil just happen a bit later in middleware

Re: Help: Should I use Admin site for everything?

2009-12-17 Thread Ales Zoulek
I'm not sure about the history but in general, it should. You can import and reuse any form widget admin defines. A. Dne 17.12.2009 12:36 "Yusuf Mohsinally" napsal/a: thanks. is there a way for me to easily include the different things from the admin site, like "history", form field widgets (da

Re: Help: Should I use Admin site for everything?

2009-12-17 Thread Yusuf Mohsinally
thanks. is there a way for me to easily include the different things from the admin site, like "history", form field widgets (date picker), etc. in my own app? On Thu, Dec 17, 2009 at 12:50 AM, Ales Zoulek wrote: > It realy depends on the level of customisation you'll need. > From my experien

Re: Need help: customise a multi-key dictionary sort to put None objects at the end.

2009-12-17 Thread Sam Walters
Thanks Daniel Yes, it was multiple keys not just 'department'. Will have a go and do some more reading on lambda. cheers -sam On Thu, Dec 17, 2009 at 8:38 PM, Daniel Roseman wrote: > On Dec 17, 6:23 am, Sam Walters wrote: >> Hi I have been reading stuff like: >> >> http://wiki.python.org/moin/

Re: comparing datefield

2009-12-17 Thread Russell Keith-Magee
On Thu, Dec 17, 2009 at 6:42 PM, Daniel Roseman wrote: > On Dec 17, 10:10 am, gganesh wrote: >> hi group, >>  How to compare date field types in a template ,a have field due_on >> taking DateField type .I have to compare to present date .I have tried >> the following in vain ,please help >> In a

Re: comparing datefield

2009-12-17 Thread Daniel Roseman
On Dec 17, 10:10 am, gganesh wrote: > hi group, >  How to compare date field types in a template ,a have field due_on > taking DateField type .I have to compare to present date .I have tried > the following in vain ,please help > In a template > {% if enquiry.due_on >= datetime.datetime.today %} .

Re: Caching pages that take a long time to generate

2009-12-17 Thread Tom Evans
On Wed, Dec 16, 2009 at 9:01 PM, Ales Zoulek wrote: > Obviously you need to pickle the whole generated data, not just generators. > 1] But I'd use response.content propery that returns the string no matter > how the request is created. > 2] Subclassing the cache middleware, or creating your own de

comparing datefield

2009-12-17 Thread gganesh
hi group, How to compare date field types in a template ,a have field due_on taking DateField type .I have to compare to present date .I have tried the following in vain ,please help In a template {% if enquiry.due_on >= datetime.datetime.today %} .{% end if %} and {% if enquiry.due_on__gt dat

Re: Directories inside app directory

2009-12-17 Thread bruno desthuilliers
On 16 déc, 22:35, Bill Freeman wrote: (snip helpful technical answer) > But. java practice notwithstanding, there is nothing wrong with having > several models in one models.py module, so why fight against the > design of django?  If your collection of models is truly so complex > that they should

Re: Extranet : Complete project behind login?

2009-12-17 Thread Niels
Thanks a lot. That works. Great. On Dec 16, 5:07 pm, Shawn Milochik wrote: > You can do it easily with middleware. > > Here's what I wrote for this exact purpose:http://pastebin.com/f52e6ef04 > > You will have to add it to MIDDLEWARE_CLASSES in your settings.py. > > Shawn -- You received this

Re: Need help: customise a multi-key dictionary sort to put None objects at the end.

2009-12-17 Thread Daniel Roseman
On Dec 17, 6:23 am, Sam Walters wrote: > Hi I have been reading stuff like: > > http://wiki.python.org/moin/SortingListsOfDictionaries > > I want to sort a list of dictionaries (alphanumeric values) by > multiple keys (achieved with code below). However I would like to > customise the comparator t

Re: FeedMagnet: New Django-powered website just launched

2009-12-17 Thread OkaMthembo
"Looks" great, that is ^_^ On Thu, Dec 17, 2009 at 10:21 AM, OkaMthembo wrote: > Look great, Jason. If i may ask, how long did it take from nought to > finish? > > Lloyd > > > On Thu, Dec 17, 2009 at 12:18 AM, Jason Ford wrote: > >> We just launched the public beta of FeedMagnet a few minutes a

Re: FeedMagnet: New Django-powered website just launched

2009-12-17 Thread OkaMthembo
Look great, Jason. If i may ask, how long did it take from nought to finish? Lloyd On Thu, Dec 17, 2009 at 12:18 AM, Jason Ford wrote: > We just launched the public beta of FeedMagnet a few minutes ago. It > is a Django-powered web app that helps business harness social media. > It is essential

Re: Error creating new project

2009-12-17 Thread Ales Zoulek
OK. Try: ls SITE-PACKAGES-DIR/django is there a "core", "http", "forms" dirs or dirs like examples, scripts, docs and "django"? If it's the second case, then you need to symlink one "django" dir deeper: unlink SITE-PACKAGES-DIR/django ln -s `pwd`/django-trunk/django/django SITE-PACKAGES-DIR/dj