Comparing timestamps

2009-05-30 Thread K.Berkhout
Hi, Let's say I have the following post model: class Post(models.Model): text = models.TextField() created = models.DateTimeField(auto_now=False, auto_now_add=True) last_modified = models.DateTimeField(auto_now=True, auto_now_add=False) I want to display the last_modifi

Re: Comparing timestamps

2009-05-31 Thread K.Berkhout
Thanks you very much for the solution, Damien! On 30 mei, 22:11, Damien GOMBAULT wrote: > Write a method is_modified in your Post model. > You can use datetime.timedelta to compare dates. > > def is_modified(self): >    second = datetime.timedelta(seconds=1) >    delta = self.last_modified - se

Re: Comparing timestamps

2009-05-31 Thread K.Berkhout
Hmm, seems like the method always returns false, anybody knows what goes wrong? On 31 mei, 12:29, "K.Berkhout" wrote: > Thanks you very much for the solution, Damien! > > On 30 mei, 22:11, Damien GOMBAULT wrote: > > > Write a method is_modified in your

Re: Comparing timestamps

2009-05-31 Thread K.Berkhout
Already got it, it's: timedelta(seconds=1) In stead of: datetime.timedelta(seconds=1) On 31 mei, 14:29, "K.Berkhout" wrote: > Hmm, seems like the method always returns false, anybody knows what > goes wrong? > > On 31 mei, 12:29, "K.Berkhout" wrot

Re: Migrating (importing) SQL dump for one model

2009-06-01 Thread K.Berkhout
I think a database migration tool is what you're looking for. I've no experience with such tools, but you could look on http://code.djangoproject.com/wiki/SchemaEvolution for database migration tools currently available. Kevin On 1 jun, 10:09, Bastien wrote: > Hi, > > I have a running Django pr

user.is_authenticated

2009-06-01 Thread K.Berkhout
Hi, Is there a way I can access the "user.is_authenticated" method in every view, without having to manually pass the User model to every template? Basicly I want to show a login or logout link on every page, depending on wether the visitor is logged in or not. I've included the following if stat

Re: user.is_authenticated

2009-06-01 Thread K.Berkhout
e variables from the default contexts plus > the ones you include in the dictionary... the auth context is loaded by > default (if i remember correctly)... > > hope it helps, > > g > > 2009/6/1 K.Berkhout > > > > > > > Hi, > > > Is there a

Re: request.session in template tag?

2009-06-01 Thread K.Berkhout
Looks like something similar to the problem I had, see http://groups.google.nl/group/django-users/browse_thread/thread/cf3e243d3bc5ca3b?hl=nl Kevin On 1 jun, 19:53, "bax...@gretschpages.com" wrote: > I'm trying to write a template tag that accesses the user's > request.session. My problem is,

Django SVN vs. stable

2009-06-06 Thread K.Berkhout
Hi, I'm about to start a new project using Django. Do you recommend me to start with the stable release and convert to 1.1 later, or would it be better to start with the development SVN version? Thanks, Kevin --~--~-~--~~~---~--~~ You received this message becaus

Re: The best hoster to install Django

2009-06-07 Thread K.Berkhout
Depends on what your location and the location of your (future) users is. Are you based in Europe or the USA? Kevin On 7 jun, 09:47, Bro wrote: > Thanks a lot to Kenneth Gonsalves and Dj Gilcrease :) > > Regards > Bro > > On 7 juin, 02:20, Kenneth Gonsalves wrote: > > > On Sunday 07 June 2009

Re: The best hoster to install Django

2009-06-07 Thread K.Berkhout
I forgot the "etc". :-) On 7 jun, 11:38, Kenneth Gonsalves wrote: > On Sunday 07 June 2009 14:53:17 K.Berkhout wrote: > > > Depends on what your location and the location of your (future) users > > is. > > Are you based in Europe or the USA? > >