Re: Problem with login and register form

2015-11-25 Thread Dariusz Mysior
Before template access_ownsite.html I had separated on few templates like 
login, register etc .html and it work's but now when I split it, a form is 
not forward to access_ownsite.html

W dniu wtorek, 24 listopada 2015 21:34:30 UTC+1 użytkownik Dariusz Mysior 
napisał:
>
> Hi I had a problem with display a form of login and register, please look 
> on it.
>
> my template access_ownsite.html
>
> {% load staticfiles %}
>
> 
> 
> 
> {% block title %}{% endblock %}
> 
>
>
> 
> 
> {% block content %}
> 
> {% if user.is_authenticated %}
> Jesteś zalogowany {{ user.username 
> }}
> wyloguj
> {% else %}
> Login
> {% csrf_token 
> %}
> {{form.as_p}}
> 
> 
> {% endif %}
> 
> 
> 
> {% block logout_msg %}
>  {{ info }} 
> Nikt nie jest zalogowany w tym momencie.
> {% endblock %}
> 
> 
> {% if user.is_authenticated == False %}
> Register
> {% 
> csrf_token %}
> {{form.as_p}}
> 
> 
> {% endif %}
> 
> 
> 
> copyright  Dariusz Mysior
> 
> {% endblock %}
> 
> 
>
>
>
> my view.py
>
> from django.contrib.auth.forms import UserCreationForm, AuthenticationForm
> from django.shortcuts import render_to_response, render
> from django.http import  HttpResponseRedirect
> from django.core.context_processors import csrf
> from django.contrib.auth import authenticate, login, logout
>
>
> def login_view(request):
> if request.method == 'POST':
> username = request.POST['username']
> password = request.POST['password']
> user = authenticate(username=username, password=password)
> if user is not None:
> if user.is_active:
> login(request, user)
> return HttpResponseRedirect('/accounts/my_view')
> else:
> # Return a 'disabled account' error message
> ...
> else:
> 
>
> ...

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/777e462c-1589-489b-bb0b-f4786cc81944%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Problem with login and register form

2015-11-25 Thread Dariusz Mysior
It's not fix a problem.

W dniu wtorek, 24 listopada 2015 21:34:30 UTC+1 użytkownik Dariusz Mysior 
napisał:
>
> Hi I had a problem with display a form of login and register, please look 
> on it.
>
> my template access_ownsite.html
>
> {% load staticfiles %}
>
> 
> 
> 
> {% block title %}{% endblock %}
> 
>
>
> 
> 
> {% block content %}
> 
> {% if user.is_authenticated %}
> Jesteś zalogowany {{ user.username 
> }}
> wyloguj
> {% else %}
> Login
> {% csrf_token 
> %}
> {{form.as_p}}
> 
> 
> {% endif %}
> 
> 
> 
> {% block logout_msg %}
>  {{ info }} 
> Nikt nie jest zalogowany w tym momencie.
> {% endblock %}
> 
> 
> {% if user.is_authenticated == False %}
> Register
> {% 
> csrf_token %}
> {{form.as_p}}
> 
> 
> {% endif %}
> 
> 
> 
> copyright  Dariusz Mysior
> 
> {% endblock %}
> 
> 
>
>
>
> my view.py
>
> from django.contrib.auth.forms import UserCreationForm, AuthenticationForm
> from django.shortcuts import render_to_response, render
> from django.http import  HttpResponseRedirect
> from django.core.context_processors import csrf
> from django.contrib.auth import authenticate, login, logout
>
>
> def login_view(request):
> if request.method == 'POST':
> username = request.POST['username']
> password = request.POST['password']
> user = authenticate(username=username, password=password)
> if user is not None:
> if user.is_active:
> login(request, user)
> return HttpResponseRedirect('/accounts/my_view')
> else:
> # Return a 'disabled account' error message
> ...
> else:
> 
>
> ...

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/bdff446d-0050-40af-af62-11ac4f9df446%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Problem with login and register form

2015-11-25 Thread knbk
It's a good idea to use render() instead of render_to_response(), 
see https://docs.djangoproject.com/en/1.8/topics/http/shortcuts/#render. 
That will fix the issue with the CSRF token. render() takes the request as 
the first argument, and uses a RequestContext. This is needed to run the 
context processors, which add the csrf_token to the template. 

On Wednesday, November 25, 2015 at 7:05:26 PM UTC+1, Dariusz Mysior wrote:
>
> Hmm I forget about it but I change names on form_l and form_r and effect 
> is the same, I had also info
>
>
> C:\Python34\lib\site-packages\django\template\defaulttags.py:66: 
>> UserWarning: A {% csrf_token %} was used in a template, but the context did 
>> not provide the value.  This is usually cause
>> d by not using RequestContext.
>>   "A {% csrf_token %} was used in a template, but the context "
>>
>>
> W dniu wtorek, 24 listopada 2015 21:34:30 UTC+1 użytkownik Dariusz Mysior 
> napisał:
>>
>> Hi I had a problem with display a form of login and register, please look 
>> on it.
>>
>> my template access_ownsite.html
>>
>> {% load staticfiles %}
>>
>> 
>> 
>> 
>> {% block title %}{% endblock %}
>> 
>>
>>
>> 
>> 
>> {% block content %}
>> 
>> {% if user.is_authenticated %}
>> Jesteś zalogowany {{ user.username 
>> }}
>> wyloguj
>> {% else %}
>> Login
>> {% csrf_token 
>> %}
>> {{form.as_p}}
>> 
>> 
>> {% endif %}
>> 
>> 
>> 
>> {% block logout_msg %}
>>  {{ info }} 
>> Nikt nie jest zalogowany w tym momencie.
>> {% endblock %}
>> 
>> 
>> {% if user.is_authenticated == False %}
>> Register
>> {% 
>> csrf_token %}
>> {{form.as_p}}
>> 
>> 
>> {% endif %}
>> 
>> 
>> 
>> copyright  Dariusz Mysior
>> 
>> {% endblock %}
>> 
>> 
>>
>>
>>
>> my view.py
>>
>> from django.contrib.auth.forms import UserCreationForm, AuthenticationForm
>> from django.shortcuts import render_to_response, render
>> from django.http import  HttpResponseRedirect
>> from django.core.context_processors import csrf
>> from django.contrib.auth import authenticate, login, logout
>>
>>
>> def login_view(request):
>> if request.method == 'POST':
>> username = request.POST['username']
>> password = request.POST['password']
>> user = authenticate(username=username, password=password)
>> if user is not None:
>> if user.is_active:
>> login(request, user)
>> return HttpResponseRedirect('/accounts/my_view')
>> else:
>> # Return a 'disabled account' error message
>> ...
>> else:
>> 
>>
>> ...
>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e4504d21-0587-4ebf-8a76-a69aa1afaa81%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Problem with login and register form

2015-11-25 Thread Dariusz Mysior
Hmm I forget about it but I change names on form_l and form_r and effect is 
the same, I had also info


C:\Python34\lib\site-packages\django\template\defaulttags.py:66: 
> UserWarning: A {% csrf_token %} was used in a template, but the context did 
> not provide the value.  This is usually cause
> d by not using RequestContext.
>   "A {% csrf_token %} was used in a template, but the context "
>
>
W dniu wtorek, 24 listopada 2015 21:34:30 UTC+1 użytkownik Dariusz Mysior 
napisał:
>
> Hi I had a problem with display a form of login and register, please look 
> on it.
>
> my template access_ownsite.html
>
> {% load staticfiles %}
>
> 
> 
> 
> {% block title %}{% endblock %}
> 
>
>
> 
> 
> {% block content %}
> 
> {% if user.is_authenticated %}
> Jesteś zalogowany {{ user.username 
> }}
> wyloguj
> {% else %}
> Login
> {% csrf_token 
> %}
> {{form.as_p}}
> 
> 
> {% endif %}
> 
> 
> 
> {% block logout_msg %}
>  {{ info }} 
> Nikt nie jest zalogowany w tym momencie.
> {% endblock %}
> 
> 
> {% if user.is_authenticated == False %}
> Register
> {% 
> csrf_token %}
> {{form.as_p}}
> 
> 
> {% endif %}
> 
> 
> 
> copyright  Dariusz Mysior
> 
> {% endblock %}
> 
> 
>
>
>
> my view.py
>
> from django.contrib.auth.forms import UserCreationForm, AuthenticationForm
> from django.shortcuts import render_to_response, render
> from django.http import  HttpResponseRedirect
> from django.core.context_processors import csrf
> from django.contrib.auth import authenticate, login, logout
>
>
> def login_view(request):
> if request.method == 'POST':
> username = request.POST['username']
> password = request.POST['password']
> user = authenticate(username=username, password=password)
> if user is not None:
> if user.is_active:
> login(request, user)
> return HttpResponseRedirect('/accounts/my_view')
> else:
> # Return a 'disabled account' error message
> ...
> else:
> 
>
> ...

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6538ba58-57c6-4c5c-8ebe-686ea85c184d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


django CMS 3.2 is now available

2015-11-25 Thread Daniele Procida
Hello, we released django CMS 3.2 last night, which we are very excited about.

There are lots of new improvements and functionality, but we think we have a 
Django first: a CMS with (near-complete) touch-screen support, not just for 
published websites, but for all the editing interfaces. 

(It was quite a bit harder than it sounds, let's put it like that.)

There's more at , 
and a live demo at .

Daniele

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/20151125093248.891532270%40mail.wservices.ch.
For more options, visit https://groups.google.com/d/optout.


Re: Django admin: is there an event, or another way to call a Javascript function, when a Django Admin Popup (the green plus icon) completes ?

2015-11-25 Thread boitoletre
Hi,

  I see this question is not receiving a lot of love. Perhaps we can try to 
approach it differently then:
 What is the mechanism that populates back the parentform select once the 
pop-up form is completed and saved ? (As I have very limited experience 
with front-end web technologies, I would not know where to look for the 
code implementing that functionnality).

>From here, perhaps we can try to hook some custom Javascript.

Thank you for reading,
  Ad

Le vendredi 20 novembre 2015 09:55:10 UTC+1, boito...@gmail.com a écrit :
>
> Hi,
>
>   We are developing an application that relies on dynamic admin pages 
> (based on some custom ajax). The high level idea is that, when the user 
> changes the value in a select html element that is mapped to a ForeignKey 
> on another model, we call a JS function (which triggers an asynchronous 
> request that changes the current admin form on completion).
>
>
> To achieve that, we listen to the change event of said select (to call 
> the JS function when it is fired), which works fine when the user clicks 
> a value directly in the drop-down menu proposed by the select.
>
> Sadly, when this select is populated through the Admin Popup 
> functionality (the process that starts by clicking the green plus icon to 
> open a popup window, and that completes when the user click the save button 
> on the popup window), it seems that the change event is not fired for the 
> select, as our callback is not executed, even though the selected value is 
> actually changed.
>
> Is there another event we can listen to to get the same behaviour than 
> when the user clicks a value directly from the list ? Or any other method 
> to call our JS function when the select value is set through the popup 
> completion ?
>
> Thank you for reading,
>   Ad
>
> (Full disclosure: I first tried my luck with a question on SO 
> , without great success)
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f9aa3420-d232-470e-bd36-ff094cf2eb55%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Using request object in settings.py for custom logging

2015-11-25 Thread Nikunj Badjatya
We want to separate out activity per client. This can be useful in many 
ways. Ex. 1) easier debugging of issues. 2) Running some analytics per 
client by looking at his log file. 3) Clients which are no longer a 
customer, their logs can be safely moved to lower storage tiers. etc.
Basically to help in debugging and maintenance of the application.

Thoughts?

On Wednesday, November 25, 2015 at 3:25:26 PM UTC+5:30, Jani Tiainen wrote:
>
> Well sites framework makes possible to do for example multitenancy inside 
> database.
>
> But apparently that is not your case. So why you like to log something per 
> user? What's the real usecase here?
>
> On 25.11.2015 11:45, Nikunj Badjatya wrote:
>
> Thank you for your response. 
> Well our application is single site only. AFAIK, sites framework is useful 
> when your django application serves multiple sites.
> Can you throw some more light on what can be achieved using sites ?
>
> I would like to evaluate all available options.
>
> Thanks.
>
>
> On Tuesday, November 24, 2015 at 4:54:36 PM UTC+5:30, Jani Tiainen wrote: 
>>
>> Hi,
>>
>> Problem is that you quite certainly have different users and several 
>> processess/threads which would lead logging configuration per request. 
>>
>> Is there a reason you don't use something like sites framework to 
>> differentiate clients?
>>
>>
>> On 24.11.2015 12:22, Nikunj Badjatya wrote:
>>
>> Hello,
>>
>> Currently for our application, all django logs are generated and kept at 
>> '/var/log/django.log'
>> We want to have different log files for different clients. i.e. 
>> /var/log/client-1/django.log
>> /var/log/client-2/django.log
>> /var/log/client-3/django.log
>> 
>> 
>>
>> The request object has information about the logged in user (and thus 
>> client). These inturn are stored in a mysql database. 
>>
>> How can django log file path be modified dynamically such that when 
>> client-1 is using the application, his logs go into 
>> '/var/log/client-1/django.log' and so on for other clients ?
>>
>> Using Django 1.6.11 and Python 2.7.
>> 'LOGGING' is defined in settings.py.
>>
>> Thanks.
>>
>> -- 
>> 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.
>> To view this discussion on the web visit 
>> 
>> https://groups.google.com/d/
>> msgid/django-users/c7c7d27a-2804-4993-8bb9-dd9c3fb7eeab%40googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>>
>> -- 
> 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.
> To view this discussion on the web visit 
> 
> https://groups.google.com/d/msgid/django-users/4e6070d9-b589-4001-b2c2-c9d3bbe8a4d3%40googlegroups.com
> .
> For more options, visit https://groups.google.com/d/optout.
>
>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/26fd9de6-5e19-430b-9a79-69c3d9198be5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Using request object in settings.py for custom logging

2015-11-25 Thread Jani Tiainen
Well sites framework makes possible to do for example multitenancy 
inside database.


But apparently that is not your case. So why you like to log something 
per user? What's the real usecase here?


On 25.11.2015 11:45, Nikunj Badjatya wrote:

Thank you for your response.
Well our application is single site only. AFAIK, sites framework is 
useful when your django application serves multiple sites.

Can you throw some more light on what can be achieved using sites ?

I would like to evaluate all available options.

Thanks.


On Tuesday, November 24, 2015 at 4:54:36 PM UTC+5:30, Jani Tiainen wrote:

Hi,

Problem is that you quite certainly have different users and
several processess/threads which would lead logging configuration
per request.

Is there a reason you don't use something like sites framework to
differentiate clients?


On 24.11.2015 12:22, Nikunj Badjatya wrote:

Hello,

Currently for our application, all django logs are generated and
kept at '/var/log/django.log'
We want to have different log files for different clients. i.e.
/var/log/client-1/django.log
/var/log/client-2/django.log
/var/log/client-3/django.log



The request object has information about the logged in user (and
thus client). These inturn are stored in a mysql database.

How can django log file path be modified dynamically such that
when client-1 is using the application, his logs go into
'/var/log/client-1/django.log' and so on for other clients ?

Using Django 1.6.11 and Python 2.7.
'LOGGING' is defined in settings.py.

Thanks.

-- 
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
.
To view this discussion on the web visit

https://groups.google.com/d/msgid/django-users/c7c7d27a-2804-4993-8bb9-dd9c3fb7eeab%40googlegroups.com

.
For more options, visit https://groups.google.com/d/optout
.


--
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4e6070d9-b589-4001-b2c2-c9d3bbe8a4d3%40googlegroups.com 
.

For more options, visit https://groups.google.com/d/optout.


--
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/56558556.7010309%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Using request object in settings.py for custom logging

2015-11-25 Thread Nikunj Badjatya
Thank you for your response.
Well our application is single site only. AFAIK, sites framework is useful 
when your django application serves multiple sites.
Can you throw some more light on what can be achieved using sites ?

I would like to evaluate all available options.

Thanks.


On Tuesday, November 24, 2015 at 4:54:36 PM UTC+5:30, Jani Tiainen wrote:
>
> Hi,
>
> Problem is that you quite certainly have different users and several 
> processess/threads which would lead logging configuration per request. 
>
> Is there a reason you don't use something like sites framework to 
> differentiate clients?
>
>
> On 24.11.2015 12:22, Nikunj Badjatya wrote:
>
> Hello,
>
> Currently for our application, all django logs are generated and kept at 
> '/var/log/django.log'
> We want to have different log files for different clients. i.e. 
> /var/log/client-1/django.log
> /var/log/client-2/django.log
> /var/log/client-3/django.log
> 
> 
>
> The request object has information about the logged in user (and thus 
> client). These inturn are stored in a mysql database. 
>
> How can django log file path be modified dynamically such that when 
> client-1 is using the application, his logs go into 
> '/var/log/client-1/django.log' and so on for other clients ?
>
> Using Django 1.6.11 and Python 2.7.
> 'LOGGING' is defined in settings.py.
>
> Thanks.
>
> -- 
> 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.
> To view this discussion on the web visit 
> 
> https://groups.google.com/d/msgid/django-users/c7c7d27a-2804-4993-8bb9-dd9c3fb7eeab%40googlegroups.com
> .
> For more options, visit https://groups.google.com/d/optout.
>
>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4e6070d9-b589-4001-b2c2-c9d3bbe8a4d3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.