What replaced is_ajax() is django 4

2022-02-23 Thread Jet Ezra
Hello team.
Am sending jquery requests in django 4 but I have just realised that 
checking if the requests were from jquery using is_ajax and then perform 
ajax related actions is not possible. What is replacing this, and why would 
such a cool feature be removed.

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/26537b07-cc5e-47aa-bad8-62be42c0feabn%40googlegroups.com.


Re: Email verification

2022-02-23 Thread Sebastian Jung
Hey,

a tutorial you find here:

How to Signup User and Send Verification Email in Django - Django Tutorial
(studygyaan.com)


Am Mi., 23. Feb. 2022 um 16:34 Uhr schrieb Rushikesh Chavan <
rushijs...@gmail.com>:

> I am new to django, i am working on one project which requires a feature
> of email verification  , how do I do it? Like , I want to send the email to
> the user who registered on my site and give one link in this mail which
> will verify the user
>
> --
> 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/CAKFN6W5HZR_bShSfBrTsb492bpv0dmOamtXMbxQQtfyF7BKw4Q%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/CAKGT9mwwkiuN8e78S9whEfPBEDaH%2BsLNj3KBZZgdSAbpAE13-A%40mail.gmail.com.


Re: Email verification

2022-02-23 Thread Sangeeth Joseph
you can use django allauth. just pip install django allauth
https://django-allauth.readthedocs.io/en/latest/installation.html



On Wed, Feb 23, 2022 at 9:50 PM Abubakar Siddique 
wrote:

> You can use djoser
>
>
>
> On Wed, Feb 23, 2022, 8:35 PM Rushikesh Chavan 
> wrote:
>
>> I am new to django, i am working on one project which requires a feature
>> of email verification  , how do I do it? Like , I want to send the email to
>> the user who registered on my site and give one link in this mail which
>> will verify the user
>>
>> --
>> 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/CAKFN6W5HZR_bShSfBrTsb492bpv0dmOamtXMbxQQtfyF7BKw4Q%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/CAL2GMxRz6oXX94_98dbwO9PUG-jtW0K-nOan-Hn5JYC_rq1ZVw%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/CALuh0bN7g%3DzHDOWFdMuUtXmmQCU5Zy_y53o6u42iEAnNa7RuCg%40mail.gmail.com.


Re: Email verification

2022-02-23 Thread Abubakar Siddique
You can use djoser



On Wed, Feb 23, 2022, 8:35 PM Rushikesh Chavan  wrote:

> I am new to django, i am working on one project which requires a feature
> of email verification  , how do I do it? Like , I want to send the email to
> the user who registered on my site and give one link in this mail which
> will verify the user
>
> --
> 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/CAKFN6W5HZR_bShSfBrTsb492bpv0dmOamtXMbxQQtfyF7BKw4Q%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/CAL2GMxRz6oXX94_98dbwO9PUG-jtW0K-nOan-Hn5JYC_rq1ZVw%40mail.gmail.com.


Re: Email verification

2022-02-23 Thread Antonis Christofides
You can try django-registration-redux 
.


Regards,

Antonis


On 23/02/2022 17.10, Rushikesh Chavan wrote:
I am new to django, i am working on one project which requires a feature of 
email verification  , how do I do it? Like , I want to send the email to the 
user who registered on my site and give one link in this mail which will 
verify the user

--
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/CAKFN6W5HZR_bShSfBrTsb492bpv0dmOamtXMbxQQtfyF7BKw4Q%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/fc69cc0d-cdd8-0674-3e38-06a01b3e1a23%40antonischristofides.com.


Clue Querying Objects

2022-02-23 Thread Hansel Johansyah
Dear Django users

Can you guys give me some clue, for Querying objects.
In the database I was input a price list, and when the client side fill the 
form and search.
The django will display a result price with formulas, ex:
formula = 1.8% (by the price) * rate(1000%)

Need your advice.

Thank's 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/2f63500a-31eb-46f3-a295-89fc0d5c4838n%40googlegroups.com.


Email verification

2022-02-23 Thread Rushikesh Chavan
I am new to django, i am working on one project which requires a feature of
email verification  , how do I do it? Like , I want to send the email to
the user who registered on my site and give one link in this mail which
will verify the user

-- 
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/CAKFN6W5HZR_bShSfBrTsb492bpv0dmOamtXMbxQQtfyF7BKw4Q%40mail.gmail.com.


Re: Need help in User log in, someone please help

2022-02-23 Thread Raj
Hi, 
Thanks for the response, I have tried to print the username before creating 
the user, but it did not work. I have also tried to use pdb that also 
didn't work.

How to do it can give proper instructions??
I have searched about it on google but have not received any relevant 
answer.

On Wednesday, 23 February 2022 at 12:26:42 UTC+5:30 jitendra...@gmail.com 
wrote:

> 7008080545 DM .
>
> On Wed, 23 Feb 2022, 12:22 pm Antonis Christofides, <
> ant...@antonischristofides.com> wrote:
>
>> You have this statement:
>> user = User.objects.create_user(username=username, email=email, 
>> password = password)
>>
>> Just before this statement, you need to insert a statement that will 
>> enable you to examine the value of the "username" statement. Something like 
>> this:
>>
>> print(username)
>> user = User.objects.create_user(username=username, email=email, 
>> password = password)
>>
>> This might or not might work properly with Django. What most Python 
>> programmers would do instead is this:
>>
>> import pdb; pdb.set_trace()
>> user = User.objects.create_user(username=username, email=email, 
>> password = password)
>>
>> but for that you need to know how to use pdb. It's quite simple though 
>> tricky at first. Eventually you will need to learn it, however, so now 
>> would be a good time. Search the web.
>>
>> Regards,
>>
>> Antonis
>>
>> Antonis Christofides+30-6979924665 <+30%20697%20992%204665> (mobile)
>>
>>
>>
>> On 22/02/2022 19.01, Raj wrote:
>>
>> I am trying to create register form access in django, but i am getting 
>> this
>> * " ValueError at /registerThe given username must be set" error. * 
>> Kindly help me how can I fix this bug.
>> please.
>> *here is the code of the views.py file.--->*
>> from msilib.schema import Feature
>> from pyexpat.errors import messages
>> from django.shortcuts import render, redirect
>> from django.contrib.auth.models import User, auth
>> from django.contrib import messages
>> from django.http import HttpResponse
>> from .models import Feature
>> # Create your views here.
>> def index(request):
>> return render(request,'index.html',{'features': features})
>> #=---register function---
>> def register(request):
>> if request.method == 'POST':
>> username = request.POST.get('username')
>> email = request.POST.get('email')
>> password = request.POST.get('password')
>> password2 = request.POST.get('password2')
>> # username = request.POST['username']
>> # email = request.POST['email']
>> # password = request.POST['password']
>> # password2 = request.POST['password2']
>> if password == password2:
>> if User.objects.filter(email = email).exists():
>> messages.info(request, 'Email already has been used!')
>> return redirect('register')
>> elif User.objects.filter(username= username).exists():
>> messages.info(request, 'Username already exist')
>> return redirect('register') 
>> else:
>> user = User.objects.create_user(username=username, 
>> email=email, password = password)
>> user.save();
>> print("User created")
>> return redirect('login')  #check
>> else:
>> messages.info(request, 'Incorrect password')
>> return redirect('register')
>> else:
>> return render(request, 'register.html')
>> def login(request):
>> if request.method == 'POST':
>> # username = request.POST['username']
>> # password = request.POST['password']
>> username = request.POST.get('username')
>> password = request.POST.get('password')
>> user = auth.authenticate(username = username, password = password)
>> if user is not None:
>> auth.login(request, user)
>> return redirect('/')
>> else:
>> messages.info(request,'Credential Invalid')
>> return redirect('login')
>> else:
>> return render(request, 'login.html')
>> *here is the SS of the error*[image: Screenshot (75).png]
>> -- 
>> 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 view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/c7bcf4b5-f8e7-4f84-97df-02e4655e42f1n%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...@googlegroups.com.
>>
> To view this discussion on the web 

Re: Needs help

2022-02-23 Thread Steven Mapes
If you mean how can you take an image of something and turn it into a 
working design for a LEGO build then you need to look into tools that can 
convert 2D or better, 3D captures into lego designs if such sites/code 
exists. It certainly won't be in Django, but then you can build a Django 
site to use it.

For example https://legoimage.com/ and http://me.brickapic.com/ both take 
2D images and try to convert them into lego representations. You could 
write a script to use these websites via Selenium or possible just the 
request library, then wrap a Django front end to upload the original image 
and then submit that to the site fetching the results but why not just use 
them directly

On Tuesday, 22 February 2022 at 22:21:29 UTC heman...@gmail.com wrote:

> Did you mean to turn(print) images to physical objects especially using 3D 
> printers?
>
> On Tue, Feb 22, 2022, 12:55 Antonis Christofides <
> ant...@antonischristofides.com> wrote:
>
>> Hello Loic,
>>
>> Please how to turn a picture into a LEGO version? 
>> A project that does this will be welcome.
>>
>> Not sure what you mean by that and what it has to do with Django. You 
>> aren't going to get any useful answers in this list unless you change the 
>> way you ask questions.
>>
>> You should really take some time to read 
>> http://www.catb.org/~esr/faqs/smart-questions.html.
>>
>> Regards,
>>
>> Antonis
>>
>> Antonis Christofides+30-6979924665 <+30%20697%20992%204665> (mobile)
>>
>>
>> On 22/02/2022 11.30, loic ngounou wrote:
>>
>> Please how to turn a picture into a LEGO version? 
>> A project that does this will be welcome.
>> -- 
>> 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 view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/26ef7fae-d58c-45f7-b132-c863aa2ebb03n%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...@googlegroups.com.
>>
> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/990f2eab-b8d3-5ecc-1f5f-635d44e06c05%40antonischristofides.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/3b846993-955e-4190-a984-d2216c4731fdn%40googlegroups.com.


Re: Need help in User log in, someone please help

2022-02-23 Thread waqar khan
share screen shot

On Wed, Feb 23, 2022 at 12:24 PM Antonis Christofides <
anto...@antonischristofides.com> wrote:

> You have this statement:
> user = User.objects.create_user(username=username, email=email,
> password = password)
>
> Just before this statement, you need to insert a statement that will
> enable you to examine the value of the "username" statement. Something like
> this:
>
> print(username)
> user = User.objects.create_user(username=username, email=email,
> password = password)
>
> This might or not might work properly with Django. What most Python
> programmers would do instead is this:
>
> import pdb; pdb.set_trace()
> user = User.objects.create_user(username=username, email=email,
> password = password)
>
> but for that you need to know how to use pdb. It's quite simple though
> tricky at first. Eventually you will need to learn it, however, so now
> would be a good time. Search the web.
>
> Regards,
>
> Antonis
>
> Antonis Christofides
> +30-6979924665 (mobile)
>
>
>
> On 22/02/2022 19.01, Raj wrote:
>
> I am trying to create register form access in django, but i am getting this
> * " ValueError at /registerThe given username must be set" error. *
> Kindly help me how can I fix this bug.
> please.
> *here is the code of the views.py file.--->*
> from msilib.schema import Feature
> from pyexpat.errors import messages
> from django.shortcuts import render, redirect
> from django.contrib.auth.models import User, auth
> from django.contrib import messages
> from django.http import HttpResponse
> from .models import Feature
> # Create your views here.
> def index(request):
> return render(request,'index.html',{'features': features})
> #=---register function---
> def register(request):
> if request.method == 'POST':
> username = request.POST.get('username')
> email = request.POST.get('email')
> password = request.POST.get('password')
> password2 = request.POST.get('password2')
> # username = request.POST['username']
> # email = request.POST['email']
> # password = request.POST['password']
> # password2 = request.POST['password2']
> if password == password2:
> if User.objects.filter(email = email).exists():
> messages.info(request, 'Email already has been used!')
> return redirect('register')
> elif User.objects.filter(username= username).exists():
> messages.info(request, 'Username already exist')
> return redirect('register')
> else:
> user = User.objects.create_user(username=username,
> email=email, password = password)
> user.save();
> print("User created")
> return redirect('login')  #check
> else:
> messages.info(request, 'Incorrect password')
> return redirect('register')
> else:
> return render(request, 'register.html')
> def login(request):
> if request.method == 'POST':
> # username = request.POST['username']
> # password = request.POST['password']
> username = request.POST.get('username')
> password = request.POST.get('password')
> user = auth.authenticate(username = username, password = password)
> if user is not None:
> auth.login(request, user)
> return redirect('/')
> else:
> messages.info(request,'Credential Invalid')
> return redirect('login')
> else:
> return render(request, 'login.html')
> *here is the SS of the error*[image: Screenshot (75).png]
> --
> 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/c7bcf4b5-f8e7-4f84-97df-02e4655e42f1n%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/cdfef3b3-37b4-801d-c53c-85d8176e3025%40antonischristofides.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 

how to use migrations in runtime for models creation?

2022-02-23 Thread Prashanth Patelc
hey ,
im working on dynamic models , im receiving model name and fields in
front-end

eg:
class Users(models.Model):
 name=models.Charfield(max_length=30)
 last_name=models.Charfield(max_length=30)
 ,,,
after this i dont need to save into the models.py i need to store the
data(create the table name with some fields into)postgreesql db
i need to migrate all the table(makemigrations,)

this is my code please check

from django.core.management import call_command

class CreateQueries(APIView):
def post(self, request, format=None):

table_name = request.data['table_name'] # im getting the table
name here
print(table_name,'here printing')
# model_name = '%d_%s' % (connection.tenant.id, table_name)
class Meta:
db_table = table_name
managed = False
attrs = {
'u_id': models.CharField(max_length=200),
'u_name': models.CharField(max_length=200),
'u_email': models.CharField(max_length=200),
'u_password': models.CharField(max_length=200),
'__module__': 'dynamicapp.models',
'Meta': Meta
} this is my cutom fields ,further i will receive from front-end


model = type(str(table_name), (models.Model,), attrs)


call_command('makemigrations')
call_command('migrate')

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/CAMCU6Cr_zUvnbhxKL-2k6mw7Rah9MLq%3DFZeGpBf-u1zt9EaBVg%40mail.gmail.com.


Re: profile page and new user will not save

2022-02-23 Thread Omkar Parab
Something went wrong with the signals. Paste your signals.py file.

On Wed, Feb 23, 2022, 10:52 AM 'Delvin Alexander' via Django users <
django-users@googlegroups.com> wrote:

> Hello Everyone,
>
> I am having trouble saving a new profile, and user when they are created.
> Upon creating a new user and profile, i get this:
>
> "TypeError: Profile.save() got an unexpected keyword argument
> 'force_insert'"
>
> Would anyone know why this is popping up for me
>
>
> Here is my work for that particular page as well.
>
> from django.shortcuts import render, redirect
> from django.contrib import messages
> from .forms import UserRegisterForm, UserUpdateForm, ProfileUpdateForm
> from django.contrib.auth.decorators import login_required
>
>
> 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'Your Account has been created you
> are now able to log in {username}!')
> return redirect('login')
> else:
> form = UserRegisterForm()
> return render(request, 'users/register.html', {'form': form})
>
> @login_required
> def profile(request):
> if request.method == 'POST':
> u_form = UserUpdateForm(request.POST, instance=request.user)
> p_form = ProfileUpdateForm(request.POST, request.FILES,
> instance=request.user.profile)
> if u_form.is_valid() and p_form.is_valid():
> u_form.save()
> p_form.save()
> messages.success(request, f'Your Account has been updated!')
> return redirect('profile')
> else:
> u_form = UserUpdateForm(instance=request.user)
> p_form = ProfileUpdateForm(instance=request.user.profile)
>
> context = {
> 'u_form': u_form,
> 'p_form': p_form,
> }
>
> return render(request, 'users/profile.html', context)
>
> --
> 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/39c57e72-9e09-403e-97db-562ef943db4an%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/CAJY8mfyGCYeL1xFxsQ-ZtuyxkEdS_gGAYbfvwSPYG7BbusRPww%40mail.gmail.com.