Re: 'now' outputs in UTC

2005-12-30 Thread Eugene Lazutkin
It sounds similar to what I observed (http://code.djangoproject.com/ticket/937). Django uses os.environ['TZ'] to set a time zone. It is described in details here: http://python.org/doc/2.3.5/lib/module-time.html (see tzset()). The problem is it is defined for Unix only. It appears that on Wind

'now' outputs in UTC

2005-12-30 Thread Michael Hipp
I'm playing with the following in my template: {% now "O Y-M-d H:i" %} This renders: '+ 2005-Dec-31 06:03' which appears to be UTC (6 hours later than here in central time in the US). This is on WinXP Pro and (according to Control Panel) my time zone appears to be set correctly. In se

Re: A very simple application

2005-12-30 Thread Michael Hipp
James Bennett wrote: Basically, render_to_response is a shortcut which takes the name of a template and a dictionary, and instantiates a context from the dictionary, loads the template, renders it and creates an HttpResponse from the result. Ok, if render_to_response is a shortcut, then I need

Re: A very simple application

2005-12-30 Thread James Bennett
On 12/31/05, Michael Hipp <[EMAIL PROTECTED]> wrote: > Who/what is the caller? Whatever method calls 'HttpResponse()'. In this case, the view. > It's not that I have something against render_to_response, it's that all the > tutorials and docs seem to be saying that the "correct" way is HttpRespo

Re: A very simple application

2005-12-30 Thread Michael Hipp
limodou wrote: HttpResponse just return the message to the caller, not directly to the screen. Who/what is the caller? render_to_response is a utility function provided by django, if you don't want to use it, you can do it yourself, just like: It's not that I have something against render_

Re: A very simple application

2005-12-30 Thread James Bennett
On 12/30/05, Michael Hipp <[EMAIL PROTECTED]> wrote: > I don't know how to reconcile this with what James Bennett and limodou wrote > about using render_to_response() instead of HttpResponse() as none of the > examples in the docs use render_to_response() as their return value from the > view meth

Re: A very simple application

2005-12-30 Thread limodou
> Yes. But I still seem to be off somewhere... > > From > http://www.djangoproject.com/documentation/tutorial3/#write-your-first-view > there is: > -- > from django.utils.httpwrappers import HttpResponse > > def index(request): > return HttpResponse("Hello, world. You're at the

Re: A very simple application

2005-12-30 Thread Michael Hipp
Adrian Holovaty wrote: On 12/30/05, Michael Hipp <[EMAIL PROTECTED]> wrote: But what about the "root" of the website, how do you specify a view for just "mysite.com"? To target the root, use '^$' as the regular expression, like so: urlpatterns = patterns('', (r'^$', 'path.to.my_view'),

Re: A very simple application

2005-12-30 Thread limodou
2005/12/31, Michael Hipp <[EMAIL PROTECTED]>: > > I have a base.html that is a skeleton html document with this call to my > 'simple' app added: > >{{ simple.saysomething }} You may make a wrong understand about the view, url-dispatch, and template. The view is used to provide methods which

Re: A very simple application

2005-12-30 Thread Adrian Holovaty
On 12/30/05, Michael Hipp <[EMAIL PROTECTED]> wrote: > But what about the "root" of the website, how do you specify a view for just > "mysite.com"? To target the root, use '^$' as the regular expression, like so: urlpatterns = patterns('', (r'^$', 'path.to.my_view'), ) Does this answer your

Re: Really basic question...

2005-12-30 Thread Adrian Holovaty
On 12/30/05, Michael Hipp <[EMAIL PROTECTED]> wrote: > Excellent. A suggestion might be to have it added to the generated > 'settings.py' file which currently starts out like this: > > TEMPLATE_DIRS = ( > # Put strings here, like "/home/html/django_templates". > ) > > Perhaps add "# Always us

Re: A very simple application

2005-12-30 Thread Michael Hipp
James Bennett wrote: On 12/30/05, Michael Hipp <[EMAIL PROTECTED]> wrote: I have a base.html that is a skeleton html document with this call to my 'simple' app added: {{ simple.saysomething }} You never call the view function from inside the template; by the time Django is rendering the

Re: A very simple application

2005-12-30 Thread James Bennett
On 12/30/05, James Bennett <[EMAIL PROTECTED]> wrote: > So the template tag '{{ simple.saysomething }}' would expect the view > to have included in the context a key/value pair where 'simple' is the > value, and the key is an object with a 'saysomething' attribute. Whoops. Should have been the ot

Re: A very simple application

2005-12-30 Thread James Bennett
On 12/30/05, Michael Hipp <[EMAIL PROTECTED]> wrote: > I have a base.html that is a skeleton html document with this call to my > 'simple' app added: > >{{ simple.saysomething }} You never call the view function from inside the template; by the time Django is rendering the template, the view

Re: Images. Stylesheets. Javascripts. Where do I put 'em.

2005-12-30 Thread James Bennett
On 12/30/05, scum <[EMAIL PROTECTED]> wrote: > I cannot figure out the `official` place to put images, stylesheets, > and javascripts and the process to access them. Can someone explain > their method of doing this. Except for the location you define with MEDIA_URL and MEDIA_ROOT, there is no "o

Re: Really basic question...

2005-12-30 Thread Michael Hipp
Adrian Holovaty wrote: On 12/30/05, Michael Hipp <[EMAIL PROTECTED]> wrote: Thank you! That worked great (well, once I figured out that TEMPLATE_DIRS wants Unix-style "slashes" even on this Winders box.) Ah, thanks for pointing out that the slash-style isn't well documented. I've updated th

A very simple application

2005-12-30 Thread Michael Hipp
I have a base.html that is a skeleton html document with this call to my 'simple' app added: {{ simple.saysomething }} In mysite/apps/simple/views.py there is: from django.utils.httpwrappers import HttpResponse def saysomething(request): return HttpResponse("This is from the 'simpl

Re: Really basic question...

2005-12-30 Thread Adrian Holovaty
On 12/30/05, Michael Hipp <[EMAIL PROTECTED]> wrote: > Thank you! That worked great (well, once I figured out that TEMPLATE_DIRS > wants Unix-style "slashes" even on this Winders box.) Ah, thanks for pointing out that the slash-style isn't well documented. I've updated the docs: http://www.djang

Re: Really basic question...

2005-12-30 Thread Michael Hipp
Adrian Holovaty wrote: You'll want to use the "direct to template" generic view, documented here: http://www.djangoproject.com/documentation/generic_views/#using-simple-generic-views Here's the URLconf you'd use: urlpatterns = patterns('', (r'.*', 'django.views.generic.simple.direct_to_tem

Re: Really basic question...

2005-12-30 Thread Adrian Holovaty
On 12/30/05, Michael Hipp <[EMAIL PROTECTED]> wrote: > The tracebacks I'm getting seem to be alternately complaining about my > templates and urlpatterns. So, 2 questions: > > 1) What do I put in urls.py that is a basic "catch all" pattern? > I tried: > urlpatterns = patterns('',) >

Really basic question...

2005-12-30 Thread Michael Hipp
I'm trying to get Django to put up the most basic possible template/page which consists of nothing more than an html doc with essentially nothing in it, no apps, nothing that really requires the power of Django. The tracebacks I'm getting seem to be alternately complaining about my templates

Re: Images. Stylesheets. Javascripts. Where do I put 'em.

2005-12-30 Thread Maniac
scum wrote: I cannot figure out the `official` place to put images, stylesheets, and javascripts and the process to access them. Can someone explain their method of doing this. As far as I know there is no 'official' place. But I think the good idea is to store CSS and JS with your project

Re: Problem adding new classes to a model

2005-12-30 Thread Tom Tobin
On 12/30/05, aaloy <[EMAIL PROTECTED]> wrote: > OK. That should be the problem! > It would be nice to have an option to generate these inserts also.. There is. :-) django-admin.py sqlall model_module_goes_here or just django-admin.py sqlinitialdata model_module_goes_here If you don't need ev

Images. Stylesheets. Javascripts. Where do I put 'em.

2005-12-30 Thread scum
I cannot figure out the `official` place to put images, stylesheets, and javascripts and the process to access them. Can someone explain their method of doing this. I was thinking of making a CSS_URL in the settings.py file and then calling {{CSS_URL}}/styles.css, but I can't manage that because

Re: admin-view, password-md5 problem

2005-12-30 Thread gabor
On Fri, Dec 30, 2005 at 05:13:52PM +, Afternoon wrote: > > > Django developers: when people start using monkey patches to get > around issues, it's time to prioritise fixing them properly. > > This has been discussed many times and several solutions proposed. > > Worse things could happe

Re: Django and Ruby on Rails framework roundtable: Dec. 3 in Chicago

2005-12-30 Thread Eugene Lazutkin
On behalf of all progressive people of the world I have to ask this: where is the video? "Jacob Kaplan-Moss" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > On Nov 17, 2005, at 4:13 PM, Jacob Kaplan-Moss wrote: >> I'm trying to get my hands on a DV cam to record video... If I c

User defined model fields

2005-12-30 Thread Arthur van Dorp
Hello, Is it possible to define additional field types? For example for monetary types where one always has to declare something like: amount_in_cents = meta.PositiveIntegerField() currency = meta.ForeignKey(currency) Some other complex types like coordinates in 3D space would be nice to

Re: admin-view, password-md5 problem

2005-12-30 Thread Afternoon
Django developers: when people start using monkey patches to get around issues, it's time to prioritise fixing them properly. This has been discussed many times and several solutions proposed. Worse things could happen that just using this as the template for a patch. On 28 Dec 2005,

Re: Problem adding new classes to a model

2005-12-30 Thread aaloy
2005/12/30, Adrian Holovaty : > > On 12/30/05, aaloy wrote: > > The new table appears on the admin interface, and I have introduced > > data manually on it I can see it, but when I try to modify o add a new > > record I get the exception: > > > > Exception Type: ContentTypeDoesNotExist >

Re: Problem adding new classes to a model

2005-12-30 Thread Adrian Holovaty
On 12/30/05, aaloy <[EMAIL PROTECTED]> wrote: > The new table appears on the admin interface, and I have introduced > data manually on it I can see it, but when I try to modify o add a new > record I get the exception: > > Exception Type: ContentTypeDoesNotExist > Exception Value:C

Problem adding new classes to a model

2005-12-30 Thread aaloy
Hello! I have a problem when I try to add new classes to a model. The steps I follow are: * I create the new classes * I use the administrative tool to generate the sql * I create the new tables from the generated sql. * I refresh the Django web admin The new table appears on the admin interfac

Re: Using Change Manipulators to Update Only a Subset of Model Data

2005-12-30 Thread Luke Plant
On Thu, 29 Dec 2005 17:57:45 -0800 cpburmester wrote: > I see one reccommendation described at: > > http://code.djangoproject.com/wiki/CookBookManipulatorWithPostpopulatedFields > > but I'm trying to do the inverse - allow the update of only, say, one > field and keep the rest the same whereas

Re: Maybe the easiest tutorial

2005-12-30 Thread Michael Hipp
Jarek Zgoda wrote: Looking forward to see. Here are my thoughts on current "official" Django tutorial: Anyway, it's god to see anybody working on introductory materials. Thanks for the encouragement. I'm banging away on it now. Hopefully in a few days I'll have something to show. Michae

Undo in Django

2005-12-30 Thread Yuri T.
I want to build an app where changes to certain objects would be undoable and redoable. The idea is to have those objects managed in a wiki-like way: any visitor can make a change but there is a permanent change history and anyone can reverse anyone else's actions. I am thinking of doing it with

Re: Django and Multiple Database Support

2005-12-30 Thread Simon Willison
On 29 Dec 2005, at 11:35, Scott johnson wrote: Now I haven't hacked Django much myself yet (I've been working on the back end tools, db loader and overall schema). What support does Django have for multiple db stuff? I've started a ticket to track discussions on this issue: http://code.

Re: weird template(?) error

2005-12-30 Thread wiz
> this has nothing to do with template - a mod_python error is usually > caused by a borked __repr__ - look for a missing comma at the end > of a tuple Yeah, that's it.. I'm done some tweaks to model and at some time discovered an error in __repr__.