Django Multiple File Upload for latest versions

2019-08-27 Thread Abu Yusuf
Hey there, I have checked a lot of git projects for django latest versions 
'multiple file upload' but couldn't find a great one.

Here i have created a repo for this: 
https://github.com/Revel109/django-multiupload-lts

Please check this out and create issues if you have any :) 

This project is live here: https://django-multiup-lts.herokuapp.com/

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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/02aedca4-955f-400d-8226-ba4eee1d560b%40googlegroups.com.


Re: Django Multiple File Upload for latest versions

2019-08-27 Thread Sim
here is my newbie opinion :
https://github.com/Revel109/django-multiupload-lts/issues/1

good luck

On Tue, Aug 27, 2019 at 9:30 AM Abu Yusuf 
wrote:

> Hey there, I have checked a lot of git projects for django latest versions
> 'multiple file upload' but couldn't find a great one.
>
> Here i have created a repo for this:
> https://github.com/Revel109/django-multiupload-lts
>
> Please check this out and create issues if you have any :)
>
> This project is live here: https://django-multiup-lts.herokuapp.com/
>
> 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+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/02aedca4-955f-400d-8226-ba4eee1d560b%40googlegroups.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAJenkLBLcWc1PyJt2tBR-eUwjHMdQw2sK_OrFZ2ywcmBk-dbrw%40mail.gmail.com.


Django sockets

2019-08-27 Thread Suraj Thapa FC
Anyone know making chat app using sockets in rest api

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPjsHcGdv1PbB9HpmiTtHZOy4fbnLDbD9awGOrB_k5XyYT%2BbMw%40mail.gmail.com.


Re: How can I switch AUTH_USER_MODEL for each application?

2019-08-27 Thread Mario R. Osorio
I think this is what you're looking for:

https://docs.djangoproject.com/en/2.2/topics/db/multi-db/


HTH!



On Monday, August 26, 2019 at 10:12:06 AM UTC-4, Sim wrote:
>
> https://docs.djangoproject.com/en/2.2/ref/settings/#databases 
>
> DATABASES in settings.py is a dict() and use database_routers. 
>
> Good luck
>
> On Mon, Aug 26, 2019 at 12:47 PM Ayu Nakata  > wrote:
>
>> I want to use each database in each application.
>> I tried using different settings.py for each application, but it didn't 
>> work.
>> Can you give me some advice?
>> Thank you.
>>
>> -- 
>> 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...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/d6713c1f-a0e0-439a-9731-c04f9f2f9217%40googlegroups.com
>>  
>> 
>> .
>>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/9d5be005-6ef5-4e79-8995-79b7e0c40880%40googlegroups.com.


Re: How to call an action from outside admin

2019-08-27 Thread Derek
You need to separate out the "core" functionality of your action - the part 
that processes the records - into a stand-alone function.  This function 
can then be also called from your view(s) that currently handles the 
various HTTP requests you list.

On Sunday, 25 August 2019 15:00:35 UTC+2, Ezequias Rocha wrote:
>
> Hello everyone
>
> I am using admin actions and it is great and easy. 
>
> Butner if I want to use the same function used by admin from outside (I.E. 
> Postman HTTP request or a website request). How do the Django rest 
> framework provides me?
>
> Best regards 
> Ezequias 
>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/dae24523-7a3c-432b-ba56-8e32efdb2104%40googlegroups.com.


Re: page not found but url exists

2019-08-27 Thread Frederick Johnson
I think you should remove the / at the begining

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e3b248b3-861e-41cf-9b7e-80077a8847c7%40googlegroups.com.


Database Views

2019-08-27 Thread HULUGESH B
Hi All,


I am facing issues in Django Models:

If connect databse views in models.

It shows less records than actual number of records. Kindly assist me. How 
to solve. This is not all the time.. sometimes it is correct sometimes not 
correct.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/29c228cc-295a-487e-a5df-afb1471b8730%40googlegroups.com.


how to connect django with SQL Server ?

2019-08-27 Thread leb dev
i have a django project that need to be connected with MS SQL Server . Iam 
using pyodbc package in order to make the connection but the problem is 
that once i try it it crash and display the below error :

djago.db.utils.operationalError:('08001','[08001] [microsoft][odbc sql 
server driver]neither dsn nor server keyword supplied (0) 
(sqldriverconnect); [08001] [microsoft][odbc sql server driver] Invalid 
connection string attribute (0)').

i tried with both authentication mode 

this is the views.py

from django.shortcuts import render
import pyodbc

def connect(request):
conn = pyodbc.connect(
'Driver={SQL Server};'
'Server=ip address;'
'Database=I-Base_beSQL;'
'Trusted_Connection=yes;'

)


cursor = conn.cursor()
c = cursor.execute('SELECT "first name" FROM Person   WHERE id = 2 ')

return render (request,'connect.html',{"c":c})



or 

from django.shortcuts import render
import pyodbc

def connect(request):
conn = pyodbc.connect(
'Driver={SQL Server};'
'Server=ip address;'
'Database=I-Base_beSQL;'
'Trusted_Connection=no;'

 'UID=SQLTest;'

  'PWD=;'

)


cursor = conn.cursor()
c = cursor.execute('SELECT "first name" FROM Person   WHERE id = 2 ')

return render (request,'connect.html',{"c":c})

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f2b220b3-be7a-47eb-a6ae-d4b040ef7cc1%40googlegroups.com.


Establish a connection between django and SQL Server using pyodbc

2019-08-27 Thread leb dev
I have a django project that make a connection between django and SQL 
server  the problem is that once the system run it display the below error:

> djago.db.utils.operationalError:('08001','[08001] [microsoft][odbc sql
> server driver]neither dsn nor server keyword supplied (0)
> (sqldriverconnect); [08001] [microsoft][odbc sql server driver]
> Invalid connection string attribute (0)')

I know that the code 08001 mean *Client unable to establish connection*

But all the credentials are correct. What am I missing here?



views.py

from django.shortcuts import render
import pyodbc
   
def connect(request):
conn = pyodbc.connect(
'Driver={SQL Server};'
'Server=ip address;'
'Database=I-Base_beSQL;'
'Trusted_Connection=yes;'

)


cursor = conn.cursor()
c = cursor.execute('SELECT "first name" FROM Person   WHERE id = 2 
')

return render (request,'connect.html',{"c":c})

connect.html

{% for row in c %}
{{ row }}
{% endfor %}

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7da39e65-4304-4929-98bb-ce19edab7372%40googlegroups.com.


Re: page not found but url exists

2019-08-27 Thread Kean
Hi Luca,

your suggestion worked, thank you.
many thanks to the community for the ongoing advice and help, it really makes a 
huge and valuable difference.

Best,

K
On 26 Aug 2019, at 20:59, Luca Mazzilli  wrote:

> Kean,
> Have you tried removing the initial slash inside the path?
> 
> -- 
> 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 view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/bc263648-0291-44af-96c6-a7f1b2f5141f%40googlegroups.com.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/69D7446F-F707-4AE7-AAEA-6F056B9EE719%40gmail.com.


Re: User Register form not validating or returning errors.

2019-08-27 Thread Kean
Hi Ajeet, thanks for code, 
however after i press submit i get the

Forbidden (403)
CSRF verification failed. Request aborted.
Help
Reason given for failure:
CSRF token missing or incorrect.

In general, this can occur when there is a genuine Cross Site Request Forgery, 
or when Django's CSRF mechanism has not been used correctly. For POST forms, 
you need to ensure:
Your browser is accepting cookies.
The view function passes a request to the template's render method.
In the template, there is a {% csrf_token %} template tag inside each POST form 
that targets an internal URL.
If you are not using CsrfViewMiddleware, then you must use csrf_protect on any 
views that use the csrf_token template tag, as well as those that accept the 
POST data.
The form has a valid CSRF token. After logging in in another browser tab or 
hitting the back button after a login, you may need to reload the page with the 
form, because the token is rotated after a login.
You're seeing the help section of this page because you have DEBUG = True in 
your Django settings file. Change that to False, and only the initial error 
message will be displayed.
You can customize this page using the CSRF_FAILURE_VIEW setting.

my template is referencing csrf_token

template.html




Customer


 "Customer register" 





  




Am i doing something wrong?

Best,
K

On 25 Aug 2019, at 08:57, Ajeet Kumar Gupt  wrote:

> Hi, 
> 
> Please use the below code.
> 
> views.py
> __
> 
> def user_register(request):
> # if this is a POST request we need to process the form data
> template = 'mymodule/register.html'
># template = 'index.html'
> if request.method == 'POST':
> # create a form instance and populate it with data from the request:
> form = RegisterForm(request.POST)
> # check whether it's valid:
> if form.is_valid():
> if 
> User.objects.filter(username=form.cleaned_data['username']).exists():
> return render(request, template, {
> 'form': form,
> 'error_message': 'Username already exists.'
> })
> elif 
> User.objects.filter(email=form.cleaned_data['email']).exists():
> return render(request, template, {
> 'form': form,
> 'error_message': 'Email already exists.'
> })
> elif form.cleaned_data['password'] != 
> form.cleaned_data['password_repeat']:
> return render(request, template, {
> 'form': form,
> 'error_message': 'Passwords do not match.'
> })
> else:
> # Create the user:
> user = User.objects.create_user(
> form.cleaned_data['username'],
> form.cleaned_data['email'],
> form.cleaned_data['password']
> )
> user.first_name = form.cleaned_data['first_name']
> user.last_name = form.cleaned_data['last_name']
> user.phone_number = form.cleaned_data['phone_number']
> user.save()
> return redirect('/login/')
> # Login the user
> #login(request, user)
> #def user_login(request):
> # redirect to accounts page:
> #return render(request, '/login.html')
># return HttpResponseRedirect(return, '/login.html')
># No post data availabe, let's just show the page.
> else:
> form = RegisterForm()
> return render(request, template, {'form': form})
> 
> On Sat, Aug 24, 2019 at 8:34 PM Kean  wrote:
> Hi,
> 
> New to Django.
> I've created a user registration form, the issue is it does not run 
> validations or report errors with the data entered. It simply routes to the 
> redirect url.
> Please can I ensure the user sees the correct error in a post case scenari 
> for both a django form, and customsied django form.
> 
> forms.py
> 
> class UserRegisterForm(UserCreationForm):
> email = forms.EmailField()
> 
> class Meta:
> model = User
> fields = 'username', 'email', 'password1', 'password2'
> 
> Views.py
> 
> def register(request):
> if request.method == 'POST':
> form = UserRegisterForm(request.POST)
> if form.is_valid():
> form.save()
> username = form.cleaned_data.get('username')
> messages.success(request, f'Account created for {username}')
> return HttpResponseRedirect('cprofile')
> else:
> form = UserRegisterForm()
> context = {'form': form}
> return render(request, "register.html", context,)
> 
> template.html
> 
>   
>   Registration
>   
>   
>   
>   

Re: User Register form not validating or returning errors.

2019-08-27 Thread Ajeet Kumar Gupt
Hi Kean,

First need to close the proper tags

I seen your code form tag is not closed properly. Once first form tag
closed than write the code csrf token

On Tue, 27 Aug, 2019, 7:30 PM Kean,  wrote:

> Hi Ajeet, thanks for code,
> however after i press submit i get the
>
> Forbidden (403)
> CSRF verification failed. Request aborted.
> Help
> Reason given for failure:
>
> CSRF token missing or incorrect.
>
>
> In general, this can occur when there is a genuine Cross Site Request
> Forgery, or when Django's CSRF mechanism
>  has not been used
> correctly. For POST forms, you need to ensure:
>
>- Your browser is accepting cookies.
>- The view function passes a request to the template's render
>
> 
> method.
>- In the template, there is a {% csrf_token %} template tag inside
>each POST form that targets an internal URL.
>- If you are not using CsrfViewMiddleware, then you must use
>csrf_protect on any views that use the csrf_token template tag, as
>well as those that accept the POST data.
>- The form has a valid CSRF token. After logging in in another browser
>tab or hitting the back button after a login, you may need to reload the
>page with the form, because the token is rotated after a login.
>
> You're seeing the help section of this page because you have DEBUG = True in
> your Django settings file. Change that to False, and only the initial
> error message will be displayed.
> You can customize this page using the CSRF_FAILURE_VIEW setting.
>
> my template is referencing csrf_token
>
> template.html
>
> 
> 
> 
> Customer
> 
> 
>  "Customer register" 
> 
> 
>  {% csrf_token %}
> {{ form.as_p }}
> 
> 
> 
> 
> 
> 
>
>
> Am i doing something wrong?
>
> Best,
> K
>
> On 25 Aug 2019, at 08:57, Ajeet Kumar Gupt 
> wrote:
>
> Hi,
>
> Please use the below code.
>
> views.py
> __
>
> def user_register(request):
> # if this is a POST request we need to process the form data
> template = 'mymodule/register.html'
># template = 'index.html'
> if request.method == 'POST':
> # create a form instance and populate it with data from the request:
> form = RegisterForm(request.POST)
> # check whether it's valid:
> if form.is_valid():
> if 
> User.objects.filter(username=form.cleaned_data['username']).exists():
> return render(request, template, {
> 'form': form,
> 'error_message': 'Username already exists.'
> })
> elif 
> User.objects.filter(email=form.cleaned_data['email']).exists():
> return render(request, template, {
> 'form': form,
> 'error_message': 'Email already exists.'
> })
> elif form.cleaned_data['password'] != 
> form.cleaned_data['password_repeat']:
> return render(request, template, {
> 'form': form,
> 'error_message': 'Passwords do not match.'
> })
> else:
> # Create the user:
> user = User.objects.create_user(
> form.cleaned_data['username'],
> form.cleaned_data['email'],
> form.cleaned_data['password']
> )
> user.first_name = form.cleaned_data['first_name']
> user.last_name = form.cleaned_data['last_name']
> user.phone_number = form.cleaned_data['phone_number']
> user.save()
> return redirect('/login/')
> # Login the user
> #login(request, user)
> #def user_login(request):
> # redirect to accounts page:
> #return render(request, '/login.html')
># return HttpResponseRedirect(return, '/login.html')
># No post data availabe, let's just show the page.
> else:
> form = RegisterForm()
> return render(request, template, {'form': form})
>
>
> On Sat, Aug 24, 2019 at 8:34 PM Kean  wrote:
>
>> Hi,
>>
>> New to Django.
>> I've created a user registration form, the issue is it does not run
>> validations or report errors with the data entered. It simply routes to the
>> redirect url.
>> Please can I ensure the user sees the correct error in a post case
>> scenari for both a django form, and customsied django form.
>>
>> forms.py
>>
>> class UserRegisterForm(UserCreationForm):
>> email = forms.EmailField()
>>
>> class Meta:
>> model = User
>> fields = 'username', 'email', 'password1', 'password2'
>>
>> Views.py
>>
>> def register(request):
>> if request.method == 'POST':
>> form = UserRegisterForm(request.POST)
>> if form.is_valid():
>> 

Re: Django sockets

2019-08-27 Thread Kasper Laudrup
On August 27, 2019 3:07:46 PM GMT+02:00, Suraj Thapa FC 
 wrote:
>Anyone know making chat app using sockets in rest api
>
>-- 
>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 view this discussion on the web visit
>https://groups.google.com/d/msgid/django-users/CAPjsHcGdv1PbB9HpmiTtHZOy4fbnLDbD9awGOrB_k5XyYT%2BbMw%40mail.gmail.com.

Hi Thapa,

Sockets (even assuming you mean websockets) and Django REST API are completely 
different things, so I'm fairly certain the answer to your very vague question 
is "no".

Kind regards,
Kasper

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/C446558D-756D-4CAD-A580-0FD8A1117970%40stacktrace.dk.


Re: Database Views

2019-08-27 Thread Jani Tiainen
Hi.

You really need to provide more context. Without knowing your data, tables
involved in a view. Your model and query you used and query you used to
verify wrong (or correct) results it is virtually impossible to help you
further.


ti 27. elok. 2019 klo 17.47 HULUGESH B  kirjoitti:

> Hi All,
>
>
> I am facing issues in Django Models:
>
> If connect databse views in models.
>
> It shows less records than actual number of records. Kindly assist me. How
> to solve. This is not all the time.. sometimes it is correct sometimes not
> correct.
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/29c228cc-295a-487e-a5df-afb1471b8730%40googlegroups.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91ocVY%2B-Z-9_GYKa0gbT5MCg%2Bh%2BvBzfLEgVf5QmnArV%2BaZw%40mail.gmail.com.


Re: User Register form not validating or returning errors.

2019-08-27 Thread Kean
Thank you, this resolved issue.

best,

K
On 27 Aug 2019, at 17:30, Ajeet Kumar Gupt  wrote:

> Hi Kean,
> 
> First need to close the proper tags
> 
> I seen your code form tag is not closed properly. Once first form tag closed 
> than write the code csrf token
> 
> On Tue, 27 Aug, 2019, 7:30 PM Kean,  wrote:
> Hi Ajeet, thanks for code, 
> however after i press submit i get the
> 
> Forbidden (403)
> CSRF verification failed. Request aborted.
> Help
> Reason given for failure:
> CSRF token missing or incorrect.
> 
> In general, this can occur when there is a genuine Cross Site Request 
> Forgery, or when Django's CSRF mechanism has not been used correctly. For 
> POST forms, you need to ensure:
> Your browser is accepting cookies.
> The view function passes a request to the template's render method.
> In the template, there is a {% csrf_token %} template tag inside each POST 
> form that targets an internal URL.
> If you are not using CsrfViewMiddleware, then you must use csrf_protect on 
> any views that use the csrf_token template tag, as well as those that accept 
> the POST data.
> The form has a valid CSRF token. After logging in in another browser tab or 
> hitting the back button after a login, you may need to reload the page with 
> the form, because the token is rotated after a login.
> You're seeing the help section of this page because you have DEBUG = True in 
> your Django settings file. Change that to False, and only the initial error 
> message will be displayed.
> You can customize this page using the CSRF_FAILURE_VIEW setting.
> 
> my template is referencing csrf_token
> 
> template.html
> 
> 
> 
> 
>   Customer
> 
> 
>"Customer register" 
>   
>   
>  {% csrf_token %}
>   {{ form.as_p }}
>   
>   
>   
> 
> 
> 
> 
> 
> Am i doing something wrong?
> 
> Best,
> K
> 
> On 25 Aug 2019, at 08:57, Ajeet Kumar Gupt  wrote:
> 
>> Hi, 
>> 
>> Please use the below code.
>> 
>> views.py
>> __
>> 
>> def user_register(request):
>> # if this is a POST request we need to process the form data
>> template = 'mymodule/register.html'
>># template = 'index.html'
>> if request.method == 'POST':
>> # create a form instance and populate it with data from the request:
>> form = RegisterForm(request.POST)
>> # check whether it's valid:
>> if form.is_valid():
>> if 
>> User.objects.filter(username=form.cleaned_data['username']).exists():
>> return render(request, template, {
>> 'form': form,
>> 'error_message': 'Username already exists.'
>> })
>> elif 
>> User.objects.filter(email=form.cleaned_data['email']).exists():
>> return render(request, template, {
>> 'form': form,
>> 'error_message': 'Email already exists.'
>> })
>> elif form.cleaned_data['password'] != 
>> form.cleaned_data['password_repeat']:
>> return render(request, template, {
>> 'form': form,
>> 'error_message': 'Passwords do not match.'
>> })
>> else:
>> # Create the user:
>> user = User.objects.create_user(
>> form.cleaned_data['username'],
>> form.cleaned_data['email'],
>> form.cleaned_data['password']
>> )
>> user.first_name = form.cleaned_data['first_name']
>> user.last_name = form.cleaned_data['last_name']
>> user.phone_number = form.cleaned_data['phone_number']
>> user.save()
>> return redirect('/login/')
>> # Login the user
>> #login(request, user)
>> #def user_login(request):
>> # redirect to accounts page:
>> #return render(request, '/login.html')
>># return HttpResponseRedirect(return, '/login.html')
>># No post data availabe, let's just show the page.
>> else:
>> form = RegisterForm()
>> return render(request, template, {'form': form})
>> 
>> On Sat, Aug 24, 2019 at 8:34 PM Kean  wrote:
>> Hi,
>> 
>> New to Django.
>> I've created a user registration form, the issue is it does not run 
>> validations or report errors with the data entered. It simply routes to the 
>> redirect url.
>> Please can I ensure the user sees the correct error in a post case scenari 
>> for both a django form, and customsied django form.
>> 
>> forms.py
>> 
>> class UserRegisterForm(UserCreationForm):
>> email = forms.EmailField()
>> 
>> class Meta:
>> model = User
>> fields = 'username', 'email', 'password1', 'password2'
>> 
>> Views.py
>> 
>> def register(req

Re: Django real-time chat app

2019-08-27 Thread Jani Tiainen
Hi.

Greatly depends on your definition of real-time...

ti 27. elok. 2019 klo 8.01 Suraj Thapa FC 
kirjoitti:

> Anyone have real-time pluggable chat system app in django.
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAPjsHcENui0Yv%2BnVYpEtxyo0ZOtwjQ6b1tCv_xtUpzW3VLMT%3Dg%40mail.gmail.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91oesbX9usLfWeH7nya1590AF_JG0K4eCw9kfcY%3DbGKEpbQ%40mail.gmail.com.


Re: User Register form not validating or returning errors.

2019-08-27 Thread Gabriel Araya Garcia
Only see the 'error_new' variable in my view
this variable has taken two values: "ok" or "error1" (true or false, error
or not error,..etc)

def NuevoPac(request):
# Manda al formulario todos los campos vacios
variable1 = 'Agregando nueva Ficha de Paciente'
variable2 = "modifica_rut"
error_new = "ok"
form   =  PacientesForm(request.POST or None)
region=  Param.objects.filter(tipo='REGI').order_by('descrip')
comuna=  Param.objects.filter(tipo='COMU').order_by('descrip')
sexo  =  Param.objects.filter(tipo='SEXO').order_by('codigo')
context = {
'form':form,
'variable1':variable1,
'variable2':variable2,
'region':region,
'comuna':comuna,
'sexo':sexo,
'error_new':error_new,
}
if request.method == "POST":
paciente = Pacientes# modelo
rut_x = request.POST.get('rut') # valor del template
existe = paciente.objects.filter(rut=rut_x).exists()
if existe == True:
error_new = 'error1'
context = {
'form':form,
'variable1':variable1,
'variable2':variable2,
'region':region,
'comuna':comuna,
'sexo':sexo,
'error_new':error_new,
}
else:
if form.is_valid():
paciente = Pacientes# modelo
form.save()
return redirect('grid_pacientes')
return render(request, 'ficha_pacientes.html',context)

Remember that 'POST' is when you give a submit botton, and you must put
this cod lines in your template:

{% if error_new == "error1" %}
 R.U.T. de Paciente ya existe !!
{% endif %}

You should put it before of the disply text fields in your template.
Therefore the alert message will be showed at the top.

please tell me if your trouble has been fixed

Sorry for my english

Gabriel Araya Garcia
Chile




El sáb., 24 ago. 2019 a las 12:34, Kean () escribió:

> Hi,
>
> New to Django.
> I've created a user registration form, the issue is it does not run
> validations or report errors with the data entered. It simply routes to the
> redirect url.
> Please can I ensure the user sees the correct error in a post case scenari
> for both a django form, and customsied django form.
>
> forms.py
>
> class UserRegisterForm(UserCreationForm):
> email = forms.EmailField()
>
> class Meta:
> model = User
> fields = 'username', 'email', 'password1', 'password2'
>
> Views.py
>
> def register(request):
> if request.method == 'POST':
> form = UserRegisterForm(request.POST)
> if form.is_valid():
> form.save()
> username = form.cleaned_data.get('username')
> messages.success(request, f'Account created for {username}')
> return HttpResponseRedirect('cprofile')
> else:
> form = UserRegisterForm()
> context = {'form': form}
> return render(request, "register.html", context,)
>
> template.html
>
> 
> Registration
> 
> 
> 
> 
> 
> {% csrf_token %}
> 
> Register
> {{ form|crispy }}
> {% if messages %}
> {% for messages in messages %}
> 
> {{ messages }}
> 
> {% endfor %}
> {% endif %}
> 
> 
> 
> Register
>
> Any help would be much appreciated
>
> Best,
>
> K
>
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/5a003506-de8d-4587-863d-3fc26e4c45c1%40googlegroups.com
> 
> .
>


-- 
Gabriel Araya Garcia
GMI - Desarrollo de Sistemas Informáticos
99.7721.15.70

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAKVvSDDDhWAQz8pAXenCoeiOcPkVBZVR6oRXBHy21GT6UJv0Aw%40mail.gmail.com.


Re: Database Views

2019-08-27 Thread Doddahulugappa.B
Thanks for your response.

In Django models.. For example

class TempUser(models.Model):
first_name = models.CharField(max_length=100)

class Meta:
managed = False
db_table = "temp_user"



temp_user is database view.

Now assume select * from temp_user

Gives 5 records


Same model if i register in admin panel.

It will show less records than 5.

Even if i do TempUser.Objects.Count()

It will show less records than 5.


Very rare case it show exactly what view is having otherwise most of
the time it fails to show exact records.

I observed this since many days in 3 to 4 projects of my django




On Tue, Aug 27, 2019, 9:01 PM Jani Tiainen  wrote:

> Hi.
>
> You really need to provide more context. Without knowing your data, tables
> involved in a view. Your model and query you used and query you used to
> verify wrong (or correct) results it is virtually impossible to help you
> further.
>
>
> ti 27. elok. 2019 klo 17.47 HULUGESH B 
> kirjoitti:
>
>> Hi All,
>>
>>
>> I am facing issues in Django Models:
>>
>> If connect databse views in models.
>>
>> It shows less records than actual number of records. Kindly assist me.
>> How to solve. This is not all the time.. sometimes it is correct sometimes
>> not correct.
>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/29c228cc-295a-487e-a5df-afb1471b8730%40googlegroups.com
>> 
>> .
>>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAHn91ocVY%2B-Z-9_GYKa0gbT5MCg%2Bh%2BvBzfLEgVf5QmnArV%2BaZw%40mail.gmail.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAKfjjGq5JFLz62UYD5CcPbYoqkOkty%2BBUz-O%2B9pwPZ%3DGazNvMw%40mail.gmail.com.


Re: User Register form not validating or returning errors.

2019-08-27 Thread K. KOFFI
please put « > » before the csrf tag


Le 27 août 2019 à 16:30 +0100, Kean , a écrit :
> Hi Ajeet, thanks for code,
> however after i press submit i get the
>
> Forbidden (403)
> CSRF verification failed. Request aborted.
> Help
> Reason given for failure:
>CSRF token missing or incorrect.
>
> In general, this can occur when there is a genuine Cross Site Request 
> Forgery, or when Django's CSRF mechanism has not been used correctly. For 
> POST forms, you need to ensure:
>
> • Your browser is accepting cookies.
> • The view function passes a request to the template's render method.
> • In the template, there is a {% csrf_token %} template tag inside each POST 
> form that targets an internal URL.
> • If you are not using CsrfViewMiddleware, then you must use csrf_protect on 
> any views that use the csrf_token template tag, as well as those that accept 
> the POST data.
> • The form has a valid CSRF token. After logging in in another browser tab or 
> hitting the back button after a login, you may need to reload the page with 
> the form, because the token is rotated after a login.
>
> You're seeing the help section of this page because you have DEBUG = True in 
> your Django settings file. Change that to False, and only the initial error 
> message will be displayed.
> You can customize this page using the CSRF_FAILURE_VIEW setting.
>
> my template is referencing csrf_token
>
> template.html
>
> 
> 
> 
>   Customer
> 
> 
>"Customer register" 
>   
>   
>   
>   {% csrf_token %}
>   {{ form.as_p }}
>   
>   
>   
>   
> 
> 
>
>
> Am i doing something wrong?
>
> Best,
> K
>
> On 25 Aug 2019, at 08:57, Ajeet Kumar Gupt  wrote:
>
> > Hi,
> >
> > Please use the below code.
> >
> > views.py
> > __
> >
> > def user_register(request):
> ># if this is a POST request we need to process the form data
> >template = 'mymodule/register.html'
> >   # template = 'index.html'
> >if request.method == 'POST':
> ># create a form instance and populate it with data from the request:
> >form = RegisterForm(request.POST)
> ># check whether it's valid:
> >if form.is_valid():
> >if 
> > User.objects.filter(username=form.cleaned_data['username']).exists():
> >return render(request, template, {
> >'form': form,
> >'error_message': 'Username already exists.'
> >})
> >elif 
> > User.objects.filter(email=form.cleaned_data['email']).exists():
> >return render(request, template, {
> >'form': form,
> >'error_message': 'Email already exists.'
> >})
> >elif form.cleaned_data['password'] != 
> > form.cleaned_data['password_repeat']:
> >return render(request, template, {
> >'form': form,
> >'error_message': 'Passwords do not match.'
> >})
> >else:
> ># Create the user:
> >user = User.objects.create_user(
> >form.cleaned_data['username'],
> >form.cleaned_data['email'],
> >form.cleaned_data['password']
> >)
> >user.first_name = form.cleaned_data['first_name']
> >user.last_name = form.cleaned_data['last_name']
> >user.phone_number = form.cleaned_data['phone_number']
> >user.save()
> >return redirect('/login/')
> ># Login the user
> >#login(request, user)
> >#def user_login(request):
> ># redirect to accounts page:
> >#return render(request, '/login.html')
> >   # return HttpResponseRedirect(return, '/login.html')
> >   # No post data availabe, let's just show the page.
> >else:
> >form = RegisterForm()
> >return render(request, template, {'form': form})
> >
> > > On Sat, Aug 24, 2019 at 8:34 PM Kean  wrote:
> > > > Hi,
> > > >
> > > > New to Django.
> > > > I've created a user registration form, the issue is it does not run 
> > > > validations or report errors with the data entered. It simply routes to 
> > > > the redirect url.
> > > > Please can I ensure the user sees the correct error in a post case 
> > > > scenari for both a django form, and customsied django form.
> > > >
> > > > forms.py
> > > >
> > > > class UserRegisterForm(UserCreationForm):
> > > >     email = forms.EmailField()
> > > >
> > > >     class Meta:
> > > >         model = User
> > > >         fields = 'username', 'email', 'password1', 'password2'
> > > >
> > > > Views.py
> > > >
> > > > def register(request):
> > > >     if request.method == 'POST':
> > > >         form = UserRegisterForm(request.POST)
> > > >        

views and manager files according to MVT design pattern

2019-08-27 Thread Alejandro Cuara
Hi, 
I would like to know if does make sense to split my views.py file into 
multiple view files 
trying to have a project better organized and the same for my manager.py 
file because i noticed that
they have grown a lot, from my perspective it make sense to be align better 
with the MVT design pattern
but I would like to know the recommendation from the official documentation 
or the experts in this matter.

Thanks in advance.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ec8fb034-dd09-4de2-a61d-29563a671f55%40googlegroups.com.


How to find out when a fix will be released

2019-08-27 Thread John MacLaughlin
I see this ticket was addressed, fixed, and merged. However, it's not in 
the latest release (2.2.4)

Ticket: https://code.djangoproject.com/ticket/29393
PR: https://github.com/django/django/pull/10730

How can I find out when this fix will be released?

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/639528f1-a182-4818-a836-e65cfbf3d1d4%40googlegroups.com.


Re: views and manager files according to MVT design pattern

2019-08-27 Thread Mike Dewhirst

On 28/08/2019 4:01 am, Alejandro Cuara wrote:

Hi,
I would like to know if does make sense to split my views.py file into 
multiple view files
trying to have a project better organized and the same for my 
manager.py file because i noticed that
they have grown a lot, from my perspective it make sense to be align 
better with the MVT design pattern
but I would like to know the recommendation from the official 
documentation or the experts in this matter.




I'm no expert but I have views in a single file in some apps and in a 
views directory and multiple files in other apps. This happened 
gradually for me as the views.py file grew.


Nowadays, I move to multiple files earlier than before because it suits 
my brain better. And I don't use an IDE but prefer a plain text editor.


It is totally your call in your circumstances.



Thanks in advance.
--
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ec8fb034-dd09-4de2-a61d-29563a671f55%40googlegroups.com 
.


--
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ed16b7fa-fba1-db43-04c6-7e8bda6fdeaf%40dewhirst.com.au.


Re: Best DRF Cheatsheet?

2019-08-27 Thread Charles Thayer
I did find a few cheat sheets online, but I was looking for something 
that's a bit more dense and assumes you have already been doing some 
programming in DRF for a while, and just need some of the details handy to 
move quickly.

* https://github.com/Nifled/drf-cheat-sheet  - more of a mini-tutorial 
because it covers a lot
* https://gitlab.com/snippets/1889671 - I started writing some of my notes 
here and it's very incomplete, plus I would want this in a single page 
visual.

Thanks

On Wednesday, August 21, 2019 at 11:34:30 AM UTC-7, mohammed habib wrote:
>
> Maybe we should make one 
>
>
> On 21 Aug 2019, at 19:58, Charles Thayer > 
> wrote:
>
> I've been using Django with DRF off and on for probably over 5 years now. 
> There are still parts that I'm always needing to look up and review. Anyone 
> know of a one-pager cheatsheet that covers all the annoying details well, 
> like read_only vs write_only vs required, and nesting serializers, etc.?
>
> Thanks,
> /charles
>
> -- 
> 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...@googlegroups.com .
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/d768f5b6-c52d-4831-bf0a-aa27ca366d47%40googlegroups.com
>  
> 
> .
>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e36eb804-bdc4-49d6-9a9a-10289d658ef2%40googlegroups.com.


Re: How to find out when a fix will be released

2019-08-27 Thread wd
It's so weird, the code is already in master 7 months, but still not
released yet?

On Wed, Aug 28, 2019 at 6:09 AM John MacLaughlin <
john.maclaugh...@carbonlighthouse.com> wrote:

> I see this ticket was addressed, fixed, and merged. However, it's not in
> the latest release (2.2.4)
>
> Ticket: https://code.djangoproject.com/ticket/29393
> PR: https://github.com/django/django/pull/10730
>
> How can I find out when this fix will be released?
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/639528f1-a182-4818-a836-e65cfbf3d1d4%40googlegroups.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CABexzmi8ad8r6n978Bs-O1A0_T-FX3fS%2BnJL-iGeyKokHWRJjg%40mail.gmail.com.


Re: How to find out when a fix will be released

2019-08-27 Thread Jani Tiainen
It's not weird at all. Django has 8 month release cycle. Usually only bugs
that are security issues or causes data loss are backported to older
releases.

I think this procedure is documented somewhere...

ke 28. elok. 2019 klo 8.06 wd  kirjoitti:

> It's so weird, the code is already in master 7 months, but still not
> released yet?
>
> On Wed, Aug 28, 2019 at 6:09 AM John MacLaughlin <
> john.maclaugh...@carbonlighthouse.com> wrote:
>
>> I see this ticket was addressed, fixed, and merged. However, it's not in
>> the latest release (2.2.4)
>>
>> Ticket: https://code.djangoproject.com/ticket/29393
>> PR: https://github.com/django/django/pull/10730
>>
>> How can I find out when this fix will be released?
>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/639528f1-a182-4818-a836-e65cfbf3d1d4%40googlegroups.com
>> 
>> .
>>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CABexzmi8ad8r6n978Bs-O1A0_T-FX3fS%2BnJL-iGeyKokHWRJjg%40mail.gmail.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91oebax64wepMOxuh2vWsVzYuBGPhsbfHDXymf%3Dx8m_h5Ww%40mail.gmail.com.


Re: How to find out when a fix will be released

2019-08-27 Thread Jani Tiainen
Oh yes there it is explained in depth

https://docs.djangoproject.com/en/dev/internals/release-process/#supported-versions

ke 28. elok. 2019 klo 8.12 Jani Tiainen  kirjoitti:

> It's not weird at all. Django has 8 month release cycle. Usually only bugs
> that are security issues or causes data loss are backported to older
> releases.
>
> I think this procedure is documented somewhere...
>
> ke 28. elok. 2019 klo 8.06 wd  kirjoitti:
>
>> It's so weird, the code is already in master 7 months, but still not
>> released yet?
>>
>> On Wed, Aug 28, 2019 at 6:09 AM John MacLaughlin <
>> john.maclaugh...@carbonlighthouse.com> wrote:
>>
>>> I see this ticket was addressed, fixed, and merged. However, it's not in
>>> the latest release (2.2.4)
>>>
>>> Ticket: https://code.djangoproject.com/ticket/29393
>>> PR: https://github.com/django/django/pull/10730
>>>
>>> How can I find out when this fix will be released?
>>>
>>> --
>>> 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 view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/639528f1-a182-4818-a836-e65cfbf3d1d4%40googlegroups.com
>>> 
>>> .
>>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CABexzmi8ad8r6n978Bs-O1A0_T-FX3fS%2BnJL-iGeyKokHWRJjg%40mail.gmail.com
>> 
>> .
>>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91ofghfnRgfqMA7L9ntp3MgqKFr7uEw%2BRFdVKxtXMcvmU7w%40mail.gmail.com.


Re: Database Views

2019-08-27 Thread Doddahulugappa.B
Thank you. I got it.. Issue with timezone

By default django considering
TIME_ZONE = 'UTC'
USE_TZ = True

Thats the reason it was showing less records than actual..
I changed it local to local time zone name and USE_TZ = False

Its working perfectly.. I also understood that its not only to database
views, its also applicable to tables also.

Kindly make sure to change above two lines in setting according to ur local
time zone to render correct records.

Thank you.


On Tue, Aug 27, 2019, 10:02 PM Doddahulugappa.B 
wrote:

> Thanks for your response.
>
> In Django models.. For example
>
> class TempUser(models.Model):
> first_name = models.CharField(max_length=100)
>
> class Meta:
> managed = False
> db_table = "temp_user"
>
>
>
> temp_user is database view.
>
> Now assume select * from temp_user
>
> Gives 5 records
>
>
> Same model if i register in admin panel.
>
> It will show less records than 5.
>
> Even if i do TempUser.Objects.Count()
>
> It will show less records than 5.
>
>
> Very rare case it show exactly what view is having otherwise most of the time 
> it fails to show exact records.
>
> I observed this since many days in 3 to 4 projects of my django
>
>
>
>
> On Tue, Aug 27, 2019, 9:01 PM Jani Tiainen  wrote:
>
>> Hi.
>>
>> You really need to provide more context. Without knowing your data,
>> tables involved in a view. Your model and query you used and query you used
>> to verify wrong (or correct) results it is virtually impossible to help you
>> further.
>>
>>
>> ti 27. elok. 2019 klo 17.47 HULUGESH B 
>> kirjoitti:
>>
>>> Hi All,
>>>
>>>
>>> I am facing issues in Django Models:
>>>
>>> If connect databse views in models.
>>>
>>> It shows less records than actual number of records. Kindly assist me.
>>> How to solve. This is not all the time.. sometimes it is correct sometimes
>>> not correct.
>>>
>>> --
>>> 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 view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/29c228cc-295a-487e-a5df-afb1471b8730%40googlegroups.com
>>> 
>>> .
>>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAHn91ocVY%2B-Z-9_GYKa0gbT5MCg%2Bh%2BvBzfLEgVf5QmnArV%2BaZw%40mail.gmail.com
>> 
>> .
>>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAKfjjGoar7k6qQqb%2BoOBv5S3SY-z6a4aeKdjdh_7MsR7BdZ%2BPA%40mail.gmail.com.


Re: How to find out when a fix will be released

2019-08-27 Thread wd
>
> As a concrete example, consider a moment in time halfway between the
> release of Django 5.1 and 5.2. At this point in time:
>
>- Features will be added to development master, to be released as
>Django 5.2.
>- Critical bug fixes will be applied to the stable/5.1.x branch, and
>released as 5.1.1, 5.1.2, etc.
>- Security fixes and bug fixes for data loss issues will be applied to
>master and to the stable/5.1.x, stable/5.0.x, and stable/4.2.x (LTS)
>branches. They will trigger the release of 5.1.1, 5.0.5, 4.2.8, etc.
>- Documentation fixes will be applied to master, and, if easily
>backported, to the latest stable branch, 5.1.x.
>
>
I see the PR was merged at Feb 3, Django 2.2 tagged at Apr 1, so the PR is
happened between 2.1 and 2.2, it should be released at 2.2 ?

On Wed, Aug 28, 2019 at 1:15 PM Jani Tiainen  wrote:

> Oh yes there it is explained in depth
>
>
> https://docs.djangoproject.com/en/dev/internals/release-process/#supported-versions
>
> ke 28. elok. 2019 klo 8.12 Jani Tiainen  kirjoitti:
>
>> It's not weird at all. Django has 8 month release cycle. Usually only
>> bugs that are security issues or causes data loss are backported to older
>> releases.
>>
>> I think this procedure is documented somewhere...
>>
>> ke 28. elok. 2019 klo 8.06 wd  kirjoitti:
>>
>>> It's so weird, the code is already in master 7 months, but still not
>>> released yet?
>>>
>>> On Wed, Aug 28, 2019 at 6:09 AM John MacLaughlin <
>>> john.maclaugh...@carbonlighthouse.com> wrote:
>>>
 I see this ticket was addressed, fixed, and merged. However, it's not
 in the latest release (2.2.4)

 Ticket: https://code.djangoproject.com/ticket/29393
 PR: https://github.com/django/django/pull/10730

 How can I find out when this fix will be released?

 --
 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 view this discussion on the web visit
 https://groups.google.com/d/msgid/django-users/639528f1-a182-4818-a836-e65cfbf3d1d4%40googlegroups.com
 
 .

>>> --
>>> 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 view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CABexzmi8ad8r6n978Bs-O1A0_T-FX3fS%2BnJL-iGeyKokHWRJjg%40mail.gmail.com
>>> 
>>> .
>>>
>> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAHn91ofghfnRgfqMA7L9ntp3MgqKFr7uEw%2BRFdVKxtXMcvmU7w%40mail.gmail.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CABexzmj8cY3wo4mULL%3DPUhAwPq-3ACH9FrKOL5Md%3DLSp_68tQQ%40mail.gmail.com.


Re: views and manager files according to MVT design pattern

2019-08-27 Thread Tosin Ayoola
Instead of splitting your view,  why not create a new app that way the
project will b manageable

On Aug 27, 2019 23:45, "Mike Dewhirst"  wrote:

> On 28/08/2019 4:01 am, Alejandro Cuara wrote:
>
>> Hi,
>> I would like to know if does make sense to split my views.py file into
>> multiple view files
>> trying to have a project better organized and the same for my manager.py
>> file because i noticed that
>> they have grown a lot, from my perspective it make sense to be align
>> better with the MVT design pattern
>> but I would like to know the recommendation from the official
>> documentation or the experts in this matter.
>>
>>
> I'm no expert but I have views in a single file in some apps and in a
> views directory and multiple files in other apps. This happened gradually
> for me as the views.py file grew.
>
> Nowadays, I move to multiple files earlier than before because it suits my
> brain better. And I don't use an IDE but prefer a plain text editor.
>
> It is totally your call in your circumstances.
>
>
> Thanks in advance.
>> --
>> 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 > django-users+unsubscr...@googlegroups.com>.
>> To view this discussion on the web visit https://groups.google.com/d/ms
>> gid/django-users/ec8fb034-dd09-4de2-a61d-29563a671f55%40googlegroups.com
>> > 9-4de2-a61d-29563a671f55%40googlegroups.com?utm_medium=email
>> &utm_source=footer>.
>>
>
> --
> 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 view this discussion on the web visit https://groups.google.com/d/ms
> gid/django-users/ed16b7fa-fba1-db43-04c6-7e8bda6fdeaf%40dewhirst.com.au.
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHLKn70dCfXHxBv0s4nbQDPTxpNQd4bhwDSB-bZrj1e0ZVehsg%40mail.gmail.com.


Re: User Register form not validating or returning errors.

2019-08-27 Thread Tosin Ayoola
You  didn't close the form tag that why you getting this error

On Aug 27, 2019 21:41, "K. KOFFI"  wrote:

> please put « > » before the csrf tag
>
>
> Le 27 août 2019 à 16:30 +0100, Kean , a écrit :
>
> Hi Ajeet, thanks for code,
> however after i press submit i get the
>
> Forbidden (403)
> CSRF verification failed. Request aborted.
> Help
> Reason given for failure:
>
> CSRF token missing or incorrect.
>
>
> In general, this can occur when there is a genuine Cross Site Request
> Forgery, or when Django's CSRF mechanism
>  has not been used
> correctly. For POST forms, you need to ensure:
>
>- Your browser is accepting cookies.
>- The view function passes a request to the template's render
>
> 
> method.
>- In the template, there is a {% csrf_token %} template tag inside
>each POST form that targets an internal URL.
>- If you are not using CsrfViewMiddleware, then you must use
>csrf_protect on any views that use the csrf_token template tag, as
>well as those that accept the POST data.
>- The form has a valid CSRF token. After logging in in another browser
>tab or hitting the back button after a login, you may need to reload the
>page with the form, because the token is rotated after a login.
>
> You're seeing the help section of this page because you have DEBUG = True in
> your Django settings file. Change that to False, and only the initial
> error message will be displayed.
> You can customize this page using the CSRF_FAILURE_VIEW setting.
>
> my template is referencing csrf_token
>
> template.html
>
> 
> 
> 
> Customer
> 
> 
>  "Customer register" 
> 
> 
> 
> {% csrf_token %}
> {{ form.as_p }}
> 
> 
> 
> 
> 
> 
>
>
> Am i doing something wrong?
>
> Best,
> K
>
> On 25 Aug 2019, at 08:57, Ajeet Kumar Gupt 
> wrote:
>
> Hi,
>
> Please use the below code.
>
> views.py
> __
>
> def user_register(request):
> # if this is a POST request we need to process the form data
> template = 'mymodule/register.html'
># template = 'index.html'
> if request.method == 'POST':
> # create a form instance and populate it with data from the request:
> form = RegisterForm(request.POST)
> # check whether it's valid:
> if form.is_valid():
> if 
> User.objects.filter(username=form.cleaned_data['username']).exists():
> return render(request, template, {
> 'form': form,
> 'error_message': 'Username already exists.'
> })
> elif 
> User.objects.filter(email=form.cleaned_data['email']).exists():
> return render(request, template, {
> 'form': form,
> 'error_message': 'Email already exists.'
> })
> elif form.cleaned_data['password'] != 
> form.cleaned_data['password_repeat']:
> return render(request, template, {
> 'form': form,
> 'error_message': 'Passwords do not match.'
> })
> else:
> # Create the user:
> user = User.objects.create_user(
> form.cleaned_data['username'],
> form.cleaned_data['email'],
> form.cleaned_data['password']
> )
> user.first_name = form.cleaned_data['first_name']
> user.last_name = form.cleaned_data['last_name']
> user.phone_number = form.cleaned_data['phone_number']
> user.save()
> return redirect('/login/')
> # Login the user
> #login(request, user)
> #def user_login(request):
> # redirect to accounts page:
> #return render(request, '/login.html')
># return HttpResponseRedirect(return, '/login.html')
># No post data availabe, let's just show the page.
> else:
> form = RegisterForm()
> return render(request, template, {'form': form})
>
>
> On Sat, Aug 24, 2019 at 8:34 PM Kean  wrote:
>
>> Hi,
>>
>> New to Django.
>> I've created a user registration form, the issue is it does not run
>> validations or report errors with the data entered. It simply routes to the
>> redirect url.
>> Please can I ensure the user sees the correct error in a post case
>> scenari for both a django form, and customsied django form.
>>
>> forms.py
>>
>> class UserRegisterForm(UserCreationForm):
>> email = forms.EmailField()
>>
>> class Meta:
>> model = User
>> fields = 'username', 'email', 'password1', 'password2'
>>
>> Views.py
>>
>> def register(request):
>> if request.method == 'POST':
>> form = UserRegisterForm(request.POST)
>> if form.is_valid():
>>