Authentication expiration time

2007-06-16 Thread rtconner

Hello, I'm new to DJango, but have used other frameworks.

(http://www.djangoproject.com/documentation/authentication/)
I love the fairly complete docs on authentication. I had one question
which did not get answered. Is there any concept of login expiration
time implemented in the builting authentication? Perhaps log a user
out after 30 minutes of inactivity. And what about setting cookies to
remember a user for the next time they open their browser, is this
handled by the authentication?

Thanks, DJango looks nice. I'm excited about digging in.

-Rob


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: newforms, manytomany, default value.

2007-06-16 Thread Brian Rosner

On 2007-06-05 07:52:51 -0600, larry <[EMAIL PROTECTED]> said:

> 
>> I'm not sure what "a patch in the development tree" means here. Current
>> subversion trunk doesn't seem to have anything like that.
> 
> Sorry for not being clear -- I'm (obviously) not familiar with the
> mechanism of open source / django development.  What I was referring
> to is the ticket you mentioned (4001) and the "patch" is the file
> attached to that ticket (save_instance_m2m.patch).
> 
>> Remember that the situation where a form maps precisely onto a model is
>> a very specialised case. In the general case, you need to build the
>> objects you are going to save manually anyway (since one form provides
>> information for many models). So the workaround that springs to mind in
>> this case is to forget about using form_for_model() and just build the
>> form by hand and construct the save objects in your view. It's only a
>> few lines of code.
> 
> That sounds great (in fact, I was forced to combine two tables into
> one in order to coerce the data into something that can be easily used
> by form_for_model).  However, I'm not sure where to start to come to
> grips with the concepts of "objects you are going to save", "build the
> form by hand", and "construct the save objects".
> 
> I'm guessing that this means instantiating models, creating the form
> bound to data from several different model classes, then (on POST)
> instantiating new model instances, somehow unpacking the data from the
> form into the appropriate model classes, and saving the instances.
> 
> If you can direct me to a simple example of a view that does this
> (including a many-to-many field in one of the models if such a field
> requires any special handling in the view) it would be greatly
> appreciated.  I guess my three sticking points are 1) how to create a
> form from _several_ objects, 2) how to create the form from several
> _models_ when the user is trying to add new information and 3) how to
> instantiate the multiple save objects from the POSTed form.
> 
> Many thanks for your kind assistance in what I know must be quite a
> simple operation.

You might want to check out the FormSet class that is in the 
newforms-admin branch. (django.newforms.formsets)  That branch is 
getting closer to done which means trunk will benefit from the new 
functionality of the FormSet class.

-- 
Brian Rosner
http://www.brosner.com/blog



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: newforms, manytomany, default value.

2007-06-16 Thread David Priest

Lordy, I would dearly *LOVE* for someone to answer your question!


On 07-Jun-5, at 6:52 AM, larry wrote:

>
>> I'm not sure what "a patch in the development tree" means here.  
>> Current
>> subversion trunk doesn't seem to have anything like that.
>
> Sorry for not being clear -- I'm (obviously) not familiar with the
> mechanism of open source / django development.  What I was referring
> to is the ticket you mentioned (4001) and the "patch" is the file
> attached to that ticket (save_instance_m2m.patch).
>
>> Remember that the situation where a form maps precisely onto a  
>> model is
>> a very specialised case. In the general case, you need to build the
>> objects you are going to save manually anyway (since one form  
>> provides
>> information for many models). So the workaround that springs to  
>> mind in
>> this case is to forget about using form_for_model() and just build  
>> the
>> form by hand and construct the save objects in your view. It's only a
>> few lines of code.
>
> That sounds great (in fact, I was forced to combine two tables into
> one in order to coerce the data into something that can be easily used
> by form_for_model).  However, I'm not sure where to start to come to
> grips with the concepts of "objects you are going to save", "build the
> form by hand", and "construct the save objects".
>
> I'm guessing that this means instantiating models, creating the form
> bound to data from several different model classes, then (on POST)
> instantiating new model instances, somehow unpacking the data from the
> form into the appropriate model classes, and saving the instances.
>
> If you can direct me to a simple example of a view that does this
> (including a many-to-many field in one of the models if such a field
> requires any special handling in the view) it would be greatly
> appreciated.  I guess my three sticking points are 1) how to create a
> form from _several_ objects, 2) how to create the form from several
> _models_ when the user is trying to add new information and 3) how to
> instantiate the multiple save objects from the POSTed form.
>
> Many thanks for your kind assistance in what I know must be quite a
> simple operation.
> --
> Larry Lustig
>
>
> >
>


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: mod_python without httpd.conf?

2007-06-16 Thread Graham Dumpleton

On Jun 17, 5:15 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> On 20 май, 01:25, Graham Dumpleton <[EMAIL PROTECTED]> wrote:
>
>
>
> > On May 19, 9:04 pm, Daniel Ellison <[EMAIL PROTECTED]> wrote:
>
> > > On Friday 18 May 2007 21:32:33 Graham Dumpleton wrote:
>
> > > > This will all only work if the web site administrator has also set:
>
> > > >   AllowOverride FileInfo
>
> > > > for the directory containing the .htaccessfile you want to add the
> > > > the SetHandler directive to.
>
> > > Yes, that's true. Sorry, forgot to add that bit of info. Same for 
> > > AuthConfig
> > > if you want to restrict access to sensitive projects in your 
> > > .htaccessfile.
>
> > Usingmod_pythonthere are actually ways around the lack of both these
> > overrides being set and the fact that it is possible to circumvent the
> > intention of the web administrator as far as them not providing you
> > these abilities in the first place, is why I personally wouldn't
> > recommend installingmod_pythonin a shared hosting environment where
> > there are many users running within the same web server. Luckily the
> > majority of people don't understandmod_pythonand how it works enough
> > so as to realise the mischief they could get up to. :-)
>
> > Anyway, will wait and see whether the original poster has FileInfo
> > override ability in .htaccessfiles before we consider the
> > workarounds.
>
> Can you please tell about such workarounds?

All it needs for Apache to consult .htaccess files is one of the
following overrides be allowed by setting AllowOverride directive:

  AuthConfig
  FileInfo
  Indexes
  Limit
  Options[=Option,...]

The one which people generally associate with being required for
mod_python to be usable is FileInfo.

FileInfo is seen as needed so that one can make use of the SetHandler/
AddHandler/SetEnv directives. Ie. these directives would be needed to
make the following work in a .htaccess file.

  PythonPath "['/home/[your_home]'] + sys.path"
  SetHandler python-program
  PythonHandler django.core.handlers.modpython
  SetEnv DJANGO_SETTINGS_MODULE mysite.settings
  PythonDebug On

The way mod_python is implemented, the PythonPath/PythonHandler/
PythonDebug directives are allowed anywhere. Ie., they are allowed
in .htaccess files even if FileInfo is not set. It is though still
required that the .htaccess file at least be consulted by Apache.

This is where we get back to the the AllowOverride directive, provided
at least one override is allowed, doesn't matter which, the .htaccess
file will be read and it will be possible to use the mod_python
directives in a .htaccess file.

The only problem now though is that if the override is not FileInfo,
you cant use SetHandler/AddHandler/SetEnv. The way around this though
is (provided you have mod_python 3.3), to use a PythonFixupHandler.
Thus directives in .htaccess file would be:

  PythonPath "['/home/[your_home]'] + sys.path"
  PythonFixupHandler /home/fixup.py
  PythonDebug On

In /home/fixup.py you would then have:

  from mod_python import apache

  def fixuphandler(req):
req.handler = "mod_python"
req.add_handler("PythonHandler", "django.core.handlers.modpython")
req.subprocess_env["DJANGO_SETTINGS_MODULE"] = "mysite.settings"
return apache.OK

This will not work in older version of mod_python because
'req.handler' wasn't writable in older versions. Even with older
versions one could get around the fact that req.handler is not
writable though if one was prepared to write your own C extension
module which did some nasty stuff. :-)

So, it doesn't help if you can't use .htaccess files at all, but if
you do have ability to use .htaccess but don't have FileInfo override
it will work.

One could argue that mod_python should only allow handlers to be
defined if FileInfo and/or AuthConf as appropriate is set, but doing
this now would probably break a lot of peoples existing installations.

Graham


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



cannot import name User (from django.contrib.auth.models)

2007-06-16 Thread [EMAIL PROTECTED]

I was making an application that included user profiles, and I thought
I was done with the first part so I entered an sql command and got
this:

Ian-Smiths-Computer:~/Sites/matches ismith$ python manage.py sql nest
matches.cafe: cannot import name User
1 error found.
BEGIN;
CREATE TABLE `nest_userprofile` (
`id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
`website` varchar(200) NOT NULL,
`about` longtext NOT NULL,
`avatar` varchar(100) NOT NULL,
`user_id` integer NOT NULL UNIQUE REFERENCES `auth_user` (`id`)
);
COMMIT;

Here is what my nest/models.py looks like:

from django.db import models
from django.contrib.auth.models import User

# Create your models here.

class UserProfile(models.Model):
website = models.URLField()
about = models.TextField()
avatar = models.ImageField(upload_to='avatars')
user = models.ForeignKey(User, unique=True)
I'm using it to extend the User model, but for some reason it cannot
connect to it. I then tried to re-SQL another app in my project that
hadn't had a problem, and it gave the same error.

I even included  AUTH_PROFILE_MODULE = 'nest.UserProfile'  in my
project's settings.py

I was thinking maybe I should redownload django, to reset contrib/auth/
models.py, just in case it got modified somehow.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: "bad argument to internal function"

2007-06-16 Thread Graham Dumpleton

We are trying to sort out similar problem over on mod_python list at
the moment. Your case is only the second case that has been seen
although why they have both popped up only now don't know.

Anyway, issue seems to be some subtle bug in req.read() of mod_python
which only manifests when certain unknown boundary conditions are met
with respect to the block sizes of data read in. In others words, all
dependent on random nature in which read returns data, thus not
reproducible very easily.

Start of thread in mod_python mailing list archives is:

  http://www.modpython.org/pipermail/mod_python/2007-June/023795.html

You might monitor that or actually get on the mod_python mailing list
describe your case and supply details on which version of Apache you
are using.

Graham

On Jun 16, 2:00 am, omat <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I have received an error mail which I couldn't quite understand. I
> think someone was POSTed some bad data that caused the error, because
> in themod_pythonrequest, it says:
>
> GET:,
> POST:,
>
> The posted data was so bad that it couldn't be parsed at all. Do you
> have an idea, what kind of request can cause that?
>
> Here is the traceback:
>
>  File "/usr/lib/python2.4/site-packages/django/core/handlers/base.py",
> line 77, in get_response
>response = callback(request, *callback_args, **callback_kwargs)
>
>  File "/srv/django/sites/turkpop/accounts/views.py", line 140, in
> ajax_login
>username = request.POST['u']
>
>  File "/usr/lib/python2.4/site-packages/django/core/handlers/
> modpython.py", line 69, in _get_post
>self._load_post_and_files()
>
>  File "/usr/lib/python2.4/site-packages/django/core/handlers/
> modpython.py", line 52, in _load_post_and_files
>self._post, self._files = http.QueryDict(self.raw_post_data),
> datastructures.MultiValueDict()
>
>  File "/usr/lib/python2.4/site-packages/django/core/handlers/
> modpython.py", line 119, in _get_raw_post_data
>self._raw_post_data = self._req.read()
>
> SystemError: Objects/stringobject.c:3516: bad argument to internal
> function


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: template inheritance - {% extends NEXTLOADER %}

2007-06-16 Thread Malcolm Tredinnick

On Sat, 2007-06-16 at 08:02 +, kahless wrote:
> hi,
> 
> is there a way to extend a template with the same name, but in another
> template loader ?
> more specific.. it would be nice if i could customize only specific
> blocks of templates by simply adding a new template loader (or another
> template directory) and creating a file with the same name as the
> original template..

You can do whatever you like with template loaders, so just write your
own to do exactly this. Note that you can't specify which loader is used
to load the template in the extends tag, but the template loaders are
tried in the order they are specified in the settings file, so put your
customised loader as the first one. The template loader itself is
responsible for working out which directory to look in (the
TEMPLATE_DIRS settings is read by the filesystem.py loader, for
example), so you have complete control here.

Regards,
Malcolm


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: rendering fields in newforms

2007-06-16 Thread Malcolm Tredinnick

On Fri, 2007-06-15 at 18:24 -0700, [EMAIL PROTECTED] wrote:
> Say we have class MyForm with IntegerField called 'year'. When we
> instantiate MyForm, say a = MyForm() we can get it rendered in html
> before passing to template - a.as_table(); This will contain all
> errors, previously entered data - if we instantiate MyForm from
> request.POST.
> The question is, how to get rendered field? I mean, only rendered
> field 'year' without the rest of the form?
> We can pass a.base_fieds['year'] to template - but how to do this
> before rendering the template?
> What I found out is that there is a class called BoundField and we can
> get it via unicode(a['year']) - however, this renders widget only,
> without data or errors. How to display them?
> Of course I can get rendered template and then work with it - but due
> to specific of my app, it raises UnicodeDecodeError, because it gets
> merged with non-unicode string afterwards.

Have a look at Form._html_output() and you can see how the form gets all
the information it needs.

Regards,
Malcolm



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: locale support - decimal point character

2007-06-16 Thread Malcolm Tredinnick

On Sat, 2007-06-16 at 21:39 +, schettino72 wrote:
> Hello,
> 
>I would like to change the decimal point character from "." to
> ",".
>"django settings" have several localization options but I couldnt
> find for decimal point character. Is it supported?
> 
>I am specially interested in the admin interface.
> 
>I know i can use the python locale module. but i guess it wont help
> if the admin does not support it.
> 
>i am supposed to put this code in "settings.py". Right?
> import locale
> locale.setlocale(locale.LC_ALL,"pt_BR.UTF-8")

At the moment, that won't work. Even if you execute those lines
float('1,23') won't do what you expect. Instead, all the uses of float()
-- and other conversion functions -- have to be changed to use things
like locale.atof().

This is the feature requested in #3940 and it's something I've been
looking at a bit recently to work out how we can make it work reasonably
smoothly. It's a reasonably large change, so it will be a few weeks
before it's implemented, given everything else on my plate at the moment
and the amount of testing required.

Regards,
Malcolm



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



locale support - decimal point character

2007-06-16 Thread schettino72

Hello,

   I would like to change the decimal point character from "." to
",".
   "django settings" have several localization options but I couldnt
find for decimal point character. Is it supported?

   I am specially interested in the admin interface.

   I know i can use the python locale module. but i guess it wont help
if the admin does not support it.

   i am supposed to put this code in "settings.py". Right?
import locale
locale.setlocale(locale.LC_ALL,"pt_BR.UTF-8")


Cheers,
  Eduardo


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: mod_python without httpd.conf?

2007-06-16 Thread [EMAIL PROTECTED]



On 20 май, 01:25, Graham Dumpleton <[EMAIL PROTECTED]> wrote:
> On May 19, 9:04 pm, Daniel Ellison <[EMAIL PROTECTED]> wrote:
>
> > On Friday 18 May 2007 21:32:33 Graham Dumpleton wrote:
>
> > > This will all only work if the web site administrator has also set:
>
> > >   AllowOverride FileInfo
>
> > > for the directory containing the .htaccessfile you want to add the
> > > the SetHandler directive to.
>
> > Yes, that's true. Sorry, forgot to add that bit of info. Same for AuthConfig
> > if you want to restrict access to sensitive projects in your .htaccessfile.
>
> Usingmod_pythonthere are actually ways around the lack of both these
> overrides being set and the fact that it is possible to circumvent the
> intention of the web administrator as far as them not providing you
> these abilities in the first place, is why I personally wouldn't
> recommend installingmod_pythonin a shared hosting environment where
> there are many users running within the same web server. Luckily the
> majority of people don't understandmod_pythonand how it works enough
> so as to realise the mischief they could get up to. :-)
>
> Anyway, will wait and see whether the original poster has FileInfo
> override ability in .htaccessfiles before we consider the
> workarounds.
>
> Graham

Can you please tell about such workarounds?


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: 'Session' object does not support item assignment

2007-06-16 Thread Jeremy Dunck

On 6/16/07, Vertigo <[EMAIL PROTECTED]> wrote:
> * Are Django sessions only designed to be used through the request
> context (and session middleware) ?

No, but they're most convenient that way.

> * Is there any "easy" snippet of code to do what I want (i.e update a
> Session object out of view) ?

This should do; the key point is that session_data is a pickled
dictionary.  The Session Middleware takes care of deserializing and
serializing as a convenience, but since you're not using it, you'll
have to do the extra bits yourself.

Make sure not to do this on a live DB at first, since I haven't tested it.  :)

for session in Session.objects.all():
   d = session.get_decoded()
   d['privileges'] = "foo"
   session.session_data = Session.objects.encode(d)
   session.save()

Another spelling would be this:

for session in Session.objects.all():
   d = session.get_decoded()
   d['privileges'] = "foo"
   Session.objects.save(session.session_key, d, session.expire_date)

> * Do you think the documentation could benefit more precision, to
> highlight the real distinction between "session" and
> "request.session" ? (I was tricked by the whole thing, thinking that
> sessions could be updated as easily out of the view)

Yes.  Can you open a documentation ticket on this, ideally with some
suggested verbiage?

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Out of sync model objects

2007-06-16 Thread Seighin

I have a model similar to the following:
  class Item(Model):
  name = CharField()
  fieldA = CharField(null=True)
  fieldB = CharField(null=True)

  class ItemHolderA(Model):
  item = ForeignKey('Item')

  class ItemHolderB(Model):
  item = ForeignKey('Item')

Then I attempt the following:
  item = Item.objects.create(name='ItemOne')
  holderA = ItemHolderA.objects.create(item=item)
...
  item = Item.objects.get(name='ItemOne')
  holderB = ItemHolderB.objects.create(item=item)
...
  holderA.item.fieldA = 'Foo'
  holderA.item.save()
  holderB.item.FieldB = 'Bar'
  holderB.item.save()

What I end up with n the db is item.fieldA = None because the item in
holderB is a different object than the one in HolderA.

I've only been using Django for a few months now, so I'm sure I'm
missing something obvious.  I was a bit surprised there was no object
caching, but barring that I couldn't find a way to make sure the
objects were kept in sync.  Any help on this issue would be
appreciated.

-Seighin


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



'Session' object does not support item assignment

2007-06-16 Thread Vertigo

Hi,

Using the latest SVN revision, I have an issue when manipulating
sessions (out of request).

The background:
My application stores custom user privileges in their sessions (home-
cooked version of 'per-object' permissions).
When specific conditions are met, I must 'refresh' some user sessions.

Here is my faulty code (based on a refresh of all sessions, for
simplicity here):
from django.contrib.sessions.models import Session
for session in Session.objects.all():
session['privileges'] = "foo"

And this barks the following error message:
'Session' object does not support item assignment

I had a look at the session documentation. If one misses one of the
first lines (like I did), it can lead to a mess (like I have :-) ):
"Sessions are implemented via a piece of middleware and a Django
model".
And indeed, sessions appear clean and developer-friendly in the
documentation, because they have gone through the middleware piece
(thanks to the SessionWrapper).

Now back to my problem:
* Are Django sessions only designed to be used through the request
context (and session middleware) ?
* Is there any "easy" snippet of code to do what I want (i.e update a
Session object out of view) ?
* Do you think the documentation could benefit more precision, to
highlight the real distinction between "session" and
"request.session" ? (I was tricked by the whole thing, thinking that
sessions could be updated as easily out of the view)

Thanks for your feedback.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: get subversion revision-number in a django-project

2007-06-16 Thread Udi

Ok.  I was trying something similar and I found that getting ant and
svn talking nicely was a hassle.  I ended up coming up with another
solution that I've never heard of anyone else using that I think makes
some sense.

Instead of the svn version number, I have my ant build script take the
checksum of the js/css file and append it to the url of the file.
Every time the file changes, its checksum changes.  The nice thing is
that ant has a built in checksum command and there's no need for any
svn integration, making the whole thing more portable.

In the base template:


In build.xml:




   CSS_CHECKSUM


I figured I'd throw this out there in case others are looking for
alternate solutions.

Peace,
Udi


On Jun 16, 4:52 am, Gábor Farkas <[EMAIL PROTECTED]> wrote:
> Udi wrote:
> > Mind if I ask why?
>
> i've got the idea from 
> here:http://www.thinkvitamin.com/features/webapps/serving-javascript-fast
>
> the idea is that you serve all your media files (js/css/png/jpg)
> at urls that contain for example the svn version number,
> like:
>
> /media/1432/js/form.js
>
> and you setup your webserver to send such headers along the file
> which says that the file does not need to be re-fetched for a very long
> time (let's say a year).
>
> and when you release a new version of your program,
> then, because the version-number has changed, all your media-urls change.
> but it's much better described in the article.
>
> btw. for the reference, i abandoned the "svnversion" approach.
> it produces some funny version numbers when you use svn:externals,
> so i went with "svn info" and extracting the version-number from there.
>
> and, for now i decided that i will not do it at the startup, but will do
> it at release-time (so i will extract the version-number at the
> release-time, save it to let's say revision.py, and import it into
> settings.py).
>
> gabor


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Survey: FileBrowser and FancyUpload

2007-06-16 Thread itsnotvalid

By the way I like the idea of Gmail upload methods too.
But a flash plugin could do something like "drag 'n drop" file
uploading which, javascript doesn't seem to cut right now.
It could be integrated as an option, not a requirement.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Survey: FileBrowser and FancyUpload

2007-06-16 Thread Martin Winkler

Hi Patrick,

Am Sat, 16 Jun 2007 12:47:46 +0200
schrieb patrickk <[EMAIL PROTECTED]>:

> 
> I usually don´t like the idea of using a js-framework for the  
> filebrowser.
> nevertheless, today I´ve seen this:
> http://digitarald.de/project/fancyupload/

I tried it too, and just after finishing the upload of my two images
Firefox crashed. Maybe the tool is not that stable as I wish.

Furthermore I like the filebrowser as it is right now - without any
flash plugins. So I'm personally at a strong -1 with this.

Maybe it would be better to check out how gmail does attachment
uploads, because in my opinion this is a very nice solution: After
choosing a file to upload, a new "Browse" button appears.

For me that would really be enough - please can you leave your current
behaviour at least as a fallback solution?

Martin

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Survey: FileBrowser and FancyUpload

2007-06-16 Thread Thomas Steinacher

I'm -0 on this because it's flash-based, but +1 for using MooTools.

tom


On Jun 16, 2007, at 12:47 PM, patrickk wrote:

>
> I usually don´t like the idea of using a js-framework for the
> filebrowser.
> nevertheless, today I´ve seen this:
> http://digitarald.de/project/fancyupload/
>
> it´s an swf/ajax upload-tool for multiple files with progress bar.
>
> now, I´d like to hear some opinions on integrating fancyupload with
> the filebrowser (http://trac.dedhost-sil-076.sil.at/trac/filebrowser/
> wiki).
> I´m personally -0 on this, but it´d improve usability, esp. when
> uploading multiple files where some are succesfully uploaded whereas
> others get an error message.
>
> of course, when using mootools for uploading files, i´d also rewrite
> the other javascripts using mootools. so it´s definitely a bigger
> update and that´s why I´m asking here ...
>
> thanks,
> patrick

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



accessing dictionary in a template

2007-06-16 Thread cesco

Hi,

I'm using the django-voting application whose method
get_votes_in_bulk(object) returns a "votes" dictionary like:
{object_id: {''score': score, 'num_votes': num_votes}

I'm passing this dictionary as extra_context to a template where I'm
also using the regroup tag on theobjects which I pass as the main
queryset.

So I would need to access the score and the num_votes as follow on a
specific item base (I can't iterate sequentially over the items due to
the regrouping). To be precise I would need to access as follow:

{{ votes.object.id.score }}

Of course this doesn't work because we can only use
votes.object_id.score but not votes.object.id.score. Instead I need to
first lookup the id and then access the dictionary using this id.

If it was python I could have done something like:
votes[object.id]['score']

Is there a way to do so in a template?

Thanks
Francesco


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



accessing dictionary

2007-06-16 Thread cesco

Hi,

I'm using the django-voting application whose method
get_votes_in_bulk(object) returns a "votes" dictionary like:
{object_id: {''score': score, 'num_votes': num_votes}

I'm passing this dictionary as extra_context to a template where I'm
also using the regroup tag on theobjects which I pass as the main
queryset.

So I would need to access the score and the num_votes as follow on a
specific item base (I can't iterate sequentially over the items due to
the regrouping). To be precise I would need to access as follow:

{{ votes.object.id.score }}

Of course this doesn't work because we can only use
votes.object_id.score but not votes.object.id.score. Instead I need to
first lookup the id and then access the dictionary using this id.

If it was python I could have done something like:
votes[object.id]['score']

Is there a way to do so in a template?

Thanks
Francesco


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Survey: FileBrowser and FancyUpload

2007-06-16 Thread patrickk

I usually don´t like the idea of using a js-framework for the  
filebrowser.
nevertheless, today I´ve seen this:
http://digitarald.de/project/fancyupload/

it´s an swf/ajax upload-tool for multiple files with progress bar.

now, I´d like to hear some opinions on integrating fancyupload with  
the filebrowser (http://trac.dedhost-sil-076.sil.at/trac/filebrowser/ 
wiki).
I´m personally -0 on this, but it´d improve usability, esp. when  
uploading multiple files where some are succesfully uploaded whereas  
others get an error message.

of course, when using mootools for uploading files, i´d also rewrite  
the other javascripts using mootools. so it´s definitely a bigger  
update and that´s why I´m asking here ...

thanks,
patrick


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: get subversion revision-number in a django-project

2007-06-16 Thread Gábor Farkas

Udi wrote:
> Mind if I ask why?
> 

i've got the idea from here: 
http://www.thinkvitamin.com/features/webapps/serving-javascript-fast

the idea is that you serve all your media files (js/css/png/jpg)
at urls that contain for example the svn version number,
like:

/media/1432/js/form.js

and you setup your webserver to send such headers along the file
which says that the file does not need to be re-fetched for a very long 
time (let's say a year).

and when you release a new version of your program,
then, because the version-number has changed, all your media-urls change.
but it's much better described in the article.


btw. for the reference, i abandoned the "svnversion" approach.
it produces some funny version numbers when you use svn:externals,
so i went with "svn info" and extracting the version-number from there.

and, for now i decided that i will not do it at the startup, but will do 
it at release-time (so i will extract the version-number at the 
release-time, save it to let's say revision.py, and import it into 
settings.py).

gabor

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



template inheritance - {% extends NEXTLOADER %}

2007-06-16 Thread kahless

hi,

is there a way to extend a template with the same name, but in another
template loader ?
more specific.. it would be nice if i could customize only specific
blocks of templates by simply adding a new template loader (or another
template directory) and creating a file with the same name as the
original template..

this way an application writer wouldn't have to worry about creating
customization layers for the templates..
just to create enough blocks.
the only way i know would be to create two files for every template..
like 'base.html' and 'base_customized.html' .. where the _customized
version only contains the {% extends .. %} statement so it can be
overloaded... but this makes the whole thing much more verbose and
possibly slower (?)

any thoughts ?

thanks & cu,
  herbert poul
  http://sct.sphene.net/


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Sitemap questions (probably dumb ones)

2007-06-16 Thread David Larlet

2007/6/16, John DeRosa <[EMAIL PROTECTED]>:
>
> David Larlet wrote:
> >
> > Any thoughts about this implementation?
>
> I think you could get rid of FakeObject() completely:
>
> class MainSitemap(Sitemap):
>  priority = 0.8
>
>  def items(self):
>  return ["/", "/archives/", "/foo/bar/", ...]
>
>  def location(self, obj):
>  return obj
>
>
> OTOH, if your code works now, you could also leave it alone. :-)  And
> FakeObject could be a convenient central container for calculating
> information that the other methods need, if your site grows in complexity.
>

You're absolutely right, thanks for your comment and suggestion which
works perfectly too! Maybe this usage need to be documented? It
doesn't seemed evident for me at first sight and someone just ask the
same think on IRC yesterday.

David

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---