a bit like permission, but...

2009-08-21 Thread MIL
Hi there. My first django Question here ;) I am trying to make this work: def _user_gotta_go_somewhere(request): gotta_go_through = request.user.get_profile ().gotta_go_through_this_url() if gotta_go_through and gotta_go_through != request.path: return HttpRespons

Re: a bit like permission, but...

2009-08-24 Thread MIL
Exactly. Thats what I need to learn :o) Thanks alot :o) On 21 Aug., 17:25, David Zhou wrote: > On Aug 21, 2009, at 9:54 AM, MIL wrote: > > > this works fine but I dont want to repeat it in all my views: > > def my_profile(request): > >    gotta_go_through =

using mark_safe() in a view returns False

2009-08-24 Thread MIL
Since I had the pleasure of getting help in here once I will try again :o) I have read about the mark_safe, and I would like to use it, but it just returns the value "False" What am I doing wrong? i my view: from django.utils.safestring import mark_safe ... context = RequestContext

using mark_safe() in a view

2009-08-24 Thread MIL
Since I had the pleasure of getting help in here once I will try again :o) I have read about the mark_safe, and I woul like to use it, but it just returns the value "False" What am I doing wrong? i my view: context = RequestContext(request, { 'title' : title, 'p_

Re: using mark_safe() in a view returns False

2009-08-25 Thread MIL
Hi. Im sorry. I closed the question again, cause I found out that it worked just fine :o) Thanks for helping though :o) On 25 Aug., 02:51, Karen Tracey wrote: > On Mon, Aug 24, 2009 at 7:01 PM, MIL wrote:Since I had > > the pleasure of getting help in here once I will try > >

template tag response None. but why?

2009-08-25 Thread MIL
Hi guys :o) Im attempting to create a template tag but I get a strange response. it returns "None" where I put the {% if blog_detail %} tag Here is my template tag class BlogNode(Node): def __init__(self, user, varname): self.user, self.varname = user, varname d

Re: template tag response None. but why?

2009-08-26 Thread MIL
Okay. Seems logic. But Im not sure what I should do. So what would you do? Thanks On 26 Aug., 12:09, Daniel Roseman wrote: > On Aug 26, 12:44 am, MIL wrote: > > > > > Hi guys :o) > > > Im attempting to create a template tag but I get a strange response. > >

Re: template tag response None. but why?

2009-08-26 Thread MIL
=self.user) except ObjectDoesNotExist: context[self.varname] = None return "" On 26 Aug., 14:58, Daniel Roseman wrote: > On Aug 26, 1:51 pm, MIL wrote: > > > Okay. Seems logic. But Im not sure what I should do. > > > So what

Re: template tag response None. but why?

2009-08-26 Thread MIL
"" Thanks alot for your help :o) Have a nice night On 26 Aug., 14:58, Daniel Roseman wrote: > On Aug 26, 1:51 pm, MIL wrote: > > > Okay. Seems logic. But Im not sure what I should do. > > > So what would you do? > > > Thanks > > Add return &q

Re: template tag response None. but why?

2009-08-26 Thread MIL
Hi again. Sorry to disturb you again, but I ran into another issue related to this template tag I wrote. I get the following error: TemplateSyntaxError at / Caught an exception while rendering: Truncated incorrect DOUBLE value: 'user' I am not sure what it means exactly, but I beleive the erro

get an object's model name

2009-08-27 Thread MIL
Hello :o) I would like to know how to get the model name of an object. sort of like object.get_model_name or something like that Is there a way to that. I tried altering my model something like this, but it doesnt work: def get_model_name(self): return '%s'%(class) T

Re: get an object's model name

2009-08-27 Thread MIL
Thanks, both of you :o) I tried using it directly in my template like {{object.__class__.__name__}} But that didnt work. So I did it by adding this to my models: def get_model_name(self): return self.__class__.__name__ And it works Thanks again :o) On 27 Aug., 13

create a link from an object - template tag or?

2009-08-28 Thread MIL
Hi :o) I am attempting to create a simpler way to create my links. and I developed this template tag: class LinkNode(Node): def __init__(self, object): self.object = object def render(self, context): model_name = self.object.get_model_name()

Re: create a link from an object - template tag or?

2009-08-29 Thread MIL
ore about it all. Have a good day Michael On 29 Aug., 04:51, Karen Tracey wrote: > On Fri, Aug 28, 2009 at 10:34 PM, MIL wrote: > > > Hi :o) > > > I am attempting to create a simpler way to create my links. and I > > developed this template tag: > &g

Re: create a link from an object - template tag or?

2009-08-31 Thread MIL
ect) > > Not that you need it for this tag, since simple_tag works, but you may want > to > write something fancier someday. > > Bill > > On Fri, Aug 28, 2009 at 10:34 PM, MIL wrote: > > > Hi :o) > > > I am attempting to create a simpler way to create m

I experience problem with special chars like æøå in filename when using models.ImageField. and models.FileFie ld

2010-06-12 Thread MIL
I experience problem with special chars like æøå in filename when using models.ImageField. What am I doing wrong? models.py picture = models.ImageField(upload_to='pics', blank=True, verbose_name='Picture of you') Using model forms Let say I want to upload picture named "æøå.jpg" If I do tha