Re: What is the best practice to learn Django 1.5?

2013-07-01 Thread Kamil Gałuszka


On Friday, June 28, 2013 3:47:51 PM UTC+2, Roberto López López wrote:
>
> Two scoops of django is also a good book https://django.2scoops.org/ 
>
>
> +1
Two scoops of django is great. This book have many good practices and also 
very good reviews. You should definitely start it after you read 
documentation.

Cheers,
Kamil Gałuszka
 

> On 06/28/2013 03:45 PM, Gabriel wrote: 
> > 
> > Hey, you could also try Getting Started With Djangorest, that's a 
> > series of classes in everything you might need to become a Django dev. 
> > 
> > -Gabe 
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> > Groups "Django users" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> > an email to django-users...@googlegroups.com . 
> > To post to this group, send email to 
> > django...@googlegroups.com. 
>
> > Visit this group at http://groups.google.com/group/django-users. 
> > For more options, visit https://groups.google.com/groups/opt_out. 
> >   
> >   
>
>
> -- 
> Kind regards, 
>
> Roberto L�pez L�pez 
>
>
> System Developer 
> Parallab, Uni Computing 
> H�yteknologisenteret, Thorm�hlensgate 55 
> N-5008 Bergen, Norway 
> Tel:(+47) 555 84091 
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Model QuerySet used in base.html template

2013-08-25 Thread Kamil Gałuszka
Hi Radomir,

If you have something like that you should use in my opinion template 
context processor. It's very easy to write one, because it's simple python 
function.

Here you have some context_processor from django 
core: 
https://github.com/django/django/blob/master/django/core/context_processors.py

And here docs:
https://docs.djangoproject.com/en/dev/ref/templates/api/#basics

Cheers,
Kamil Galuszka

On Sunday, August 25, 2013 1:04:01 PM UTC+2, Radomir Wojcik wrote:
>
> I am actually thinking using some sort of templatetag now instead of 
> passing the query each time since its used in base.html. It can return the 
> exact html string that can be displayed in base.html.  Right now I have the 
> " locations = Location.objects.all() " passed to the template in every 
> single view.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Model QuerySet used in base.html template

2013-08-25 Thread Kamil Gałuszka
I'm just preferring if something have to be done before template rendering 
and store that in context variable.

Difference to your solution is that variables are just only created before 
starting template rendering.

In your solution you evaluate QuerySet in template rendering time. 
Sometimes is just bad idea because, you want to separate view stuff from 
template rendering (especially that django rendering time is sometimes just 
slower than for example jinja2). 

But it's just my opinion. I'm maybe wrong :) . Feel free to do what you 
suits best your needs. :)

Cheers,
Kamil 

On Sunday, August 25, 2013 3:58:55 PM UTC+2, Radomir Wojcik wrote:
>
> Hey Kamil,
>
> Isn't that overkill though? templatetag was an easy solution but you still 
> do a query on the locations model on each page load.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Two sets of registration with django-registration

2013-09-23 Thread Kamil Gałuszka

Of course.

First of all I would recommend you using of django-allauth. They are having 
great docs and they support custom user model. django-registration is 
little less maintained and maybe less suitable for your needs.

First you define your custom form in settings.py:
SIGNUP_FORM_CLASS

Then you are inherit this class 
https://github.com/pennersr/django-allauth/blob/master/allauth/account/adapter.py
 
and override method save_user to actually do what you want. 

And that is it. Is just that simple

Cheers
Kamil 



On Monday, September 23, 2013 7:32:38 PM UTC+2, Vibhu Rishi wrote:
>
> Hi, 
>
> I have 2 types of users with different views of the same page . Using 
> django-registration, I have been able to setup all the signup/password 
> change etc for one level of users - say students. 
>
> Now I want to have another set of registrations for Teachers. Is there a 
> way to achieve that ? 
>
> Vibhu
>
> -- 
> Simplicity is the ultimate sophistication. - Leonardo da Vinci
> Life is really simple, but we insist on making it complicated. - Confucius 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.