login() within form clean or outside ?

2012-03-21 Thread Nolhian
ogin() directly in the form clean method instead of the view. => seems a little strange to write it there. I have question with my lost password form since I need to set a new password which also requires a user object and then use send_mail(). How would you do it ? Thanks in advance, No

How can I load a custom template filter which is in my project directory ?

2012-02-14 Thread Nolhian
Hello everyone, In my template I put : {% load pygmentize %} But I got : TemplateSyntaxError at / 'pygmentize' is not a valid tag library: Template library pygmentize not found, tried django.templatetags.pygmentize,django.contrib.admin.templatetags.pygmentize How can I load it ? I don't want to

Re: Where is linebreaksbr function ?

2012-02-12 Thread Nolhian
>         What's so difficult about > >               "".join(data.split("\n")) Nothing ? But that's not what I wanted. 1) It can't escape. 2) If I would have wanted something like that I would have use data.replace('\n', '') which is a whole lot faster than your solution. -- You received this

Re: Where is linebreaksbr function ?

2012-02-12 Thread Nolhian
autoreponsse : Found it ! It's in django.template.defaultfilters, linebreaks is there too ! On Feb 12, 4:53 pm, Nolhian wrote: > Hello, > > I've found linebreaks, urlize and so on in django.utils.html but > linebreaksbr is not there. I need it to format my data inside my

Where is linebreaksbr function ?

2012-02-12 Thread Nolhian
Hello, I've found linebreaks, urlize and so on in django.utils.html but linebreaksbr is not there. I need it to format my data inside my view instead of the template. Any idea of its location ? Thanks in advance, Nolhian -- You received this message because you are subscribed to the G

Re: A view associated with a lot of urls

2011-11-30 Thread Nolhian
> > Well I agree that if the category doesn't exist he will get a 404. But > > if the Category exists and there are no items in the 'table', it will > > not be empty, it will also raise a 404 too.  That's why I wrote : > > >> However with that, there is no way for example to make a difference > >>

Re: A view associated with a lot of urls

2011-11-30 Thread Nolhian
Well that should work pretty well with an SQL database. But as I said my database is a NoSQL one, here I need to have one "table" per category. So creating another Categorylist table just for fun and put all the category names into, then hit it in order to check if the category exists just seems w

Re: A view associated with a lot of urls

2011-11-30 Thread Nolhian
> Sorry, it was DrBloodmoney, who wrote this: > > > class Category(models.Model): > >    name = models.CharField # should be unique > > > class Item(models.Model): > >  name = models.CharField() > >   category = models.ForeignKey(Category, related_name='items’) > Oh that, yes I intended to do

Re: A view associated with a lot of urls

2011-11-30 Thread Nolhian
Hello, >As Reinout suggested you should have a CategoryModel which you can check >if a >Category exists and the get the items of show that the category does not >>exist or 404 if somebody entered a wrong URL/Category. Checking against the >>DB is probably the same thing you want to do, but it

Re: A view associated with a lot of urls

2011-11-30 Thread Nolhian
filled with category names and one filled with item names to make sure that the category is in the list/dict and same for the item before hitting the database, and if not respond with a 404. On Nov 30, 8:53 am, Reinout van Rees wrote: > On 29-11-11 21:37, Nolhian wrote: > > > How

Re: A view associated with a lot of urls

2011-11-29 Thread Nolhian
say that I use a NoSQL database, so I'll put every item directly in the category 'table'. Thanks for your help ! Nolhian On Nov 29, 10:22 pm, DrBloodmoney wrote: > On Tue, Nov 29, 2011 at 3:37 PM, Nolhian wrote: > > Thanks ! > > > So you'll not check if

Re: A view associated with a lot of urls

2011-11-29 Thread Nolhian
uot;this category doesn't exist" ! Well that could be a solution but only 1 collection for a lot of different unrelated categories seems really odd to me, why not a model per category ? On Nov 29, 8:30 pm, DrBloodmoney wrote: > On Tue, Nov 29, 2011 at 2:19 PM, Nolhian wrote: > &g

Re: A view associated with a lot of urls

2011-11-29 Thread Nolhian
irectly; and you might want to use a model (database table) for > each of your lookups.  The third part of the tutorial [1] addresses > this. > > [1]https://docs.djangoproject.com/en/dev/intro/tutorial03/ > > On Nov 29, 3:30 am, Nolhian wrote: > > > > > > > &g

Re: A view associated with a lot of urls

2011-11-29 Thread Nolhian
irectly; and you might want to use a model (database table) for > each of your lookups.  The third part of the tutorial [1] addresses > this. > > [1]https://docs.djangoproject.com/en/dev/intro/tutorial03/ > > On Nov 29, 3:30 am, Nolhian wrote: > > > > > > > &g

A view associated with a lot of urls

2011-11-29 Thread Nolhian
ith a 404 error page. Obviously it will be huge dicts let's say 100 keys for the first and maybe 50 for the second one. Is it the best way to go ? Won't it be slow / consume a lot of ram ( because of the dicts ) if a lot of people are viewing the pages simultaneously ? Thanks, Nolhian -

Re: Delete a Field...

2011-11-24 Thread Nolhian
Hello, I'm not familiar with ManyToMany relationships since I use Django with mongodb and this doesn't exist like so. But I'll give it a shot : > For example: "foo", "pepe1", "pepe2" are users of the project. I > delete returns "foo" > I try in every way like this: > datos=Proyectos.objects.get(i

Re: Django : CSRF and variable handling in a view

2011-11-24 Thread Nolhian
estContext ! Also I saw that the render shortcut was born with Django 1.3, that's really a cool addition. Thanks again ;) Nolhian On Nov 24, 3:23 pm, Ivo Brodien wrote: > Hi! > > Ah, ok. Now it makes a more sense - index was indeed confusing. > > Well in your template I woul

Re: Django : CSRF and variable handling in a view

2011-11-24 Thread Nolhian
m taking still feel weird ? Nolhian On Nov 24, 1:37 pm, Ivo Brodien wrote: > DrBloodMoney is right, It is kind of odd how you are solving the problem but > it might me kind of right depending on what you are trying to do. > > Considering how most of the websites work you should do t

Re: Django : CSRF and variable handling in a view

2011-11-23 Thread Nolhian
> This seems all sorts of wrong to me. Why couldn't the user just log > out and then post? Seems like an odd workflow, but I don't know your > business-case here. Yes the user can just log out and then post but since this is a sign- up form it would seem logical to not be able to sign-up if the us

Re: Django : CSRF and variable handling in a view

2011-11-23 Thread Nolhian
return render_to_response('index.html', {'has_account': True}) and check in the template {% if has_account %}. I wonder because it may be useless here to pass the whole requestcontext and it uses the same amount of code to write both solutions. What do you think ? Than

Re: Django : CSRF and variable handling in a view

2011-11-23 Thread Nolhian
you hardcode it to be False, yes it useless also to check in the > template. > > If the variable is missing a "if" in the template will evaluate to False. > > If the template is used by other views which could provide has_account =True > it should be in there, of course! >

Re: Django : CSRF and variable handling in a view

2011-11-22 Thread Nolhian
nks :) What about passing a variable set to False ? Should I still pass it like so : return render(request,'index.html', {'form': form, 'has_account':False}) Or is it useless to pass it ? On Nov 23, 5:02 am, DrBloodmoney wrote: > On Tue, Nov 22, 2011 at 6:54 PM, Nolh

Django : CSRF and variable handling in a view

2011-11-22 Thread Nolhian
27;has_account': False,'form': form}) return render_to_response('index.html', c) Which one it the best approach ? 3) I also noticed that if i don't pass 'has_account': False to my template, nothing changes, it still evaluate it as false in {% if has_accoun