Django dropdown data display issues in the control

2020-04-28 Thread Ajeet Kumar Gupt
Dear Team,

I am a beginner in Django and want to developing one assignment in django.

Now, I am created one model category and subcategory. Based on category
populate the data sub-category and data have saved like the below format.

*Category = * Operations

*Subcategory =* Category1,Category2,Category3,Category4

Same like other categories.
I want to display data in index.html page selection option like

*Subcategory: * Category1
 Category2
 Category3

e.g. I looking like this .

[image: image.png]

I tried to use split function but it is not working. Please help us its a
really appreciated.

My Code: How to split the values.


  

{% for subcat in all_subcats_keys %}

{{subcat.subcategory }}

{% endfor %}

  


*Current Scenario, data display likes *
[image: image.png]









-- 






*Thanks & Regards*
Ajeet Kumar Gupt
+91-9311232332

-- 
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/CA%2BTqRssX%3DskNUB%2BgAnfwuYxss_8fMYc0__eM_3nwAJpd-HgauQ%40mail.gmail.com.


Re: Attribute error:module 'django.db.models' has no attribute 'PhoneField'

2020-04-29 Thread Ajeet Kumar Gupt
Hi,
Install pip install django-phone-field



On Wed, Apr 29, 2020 at 11:57 AM yashwanth balanagu <
balanaguyashwa...@gmail.com> wrote:

> Attribute error:module 'django.db.models' has no attribute 'PhoneField'
>
> --
> 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/4707ee45-3b2e-4f0a-bc6b-adb8000e88bd%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/4707ee45-3b2e-4f0a-bc6b-adb8000e88bd%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>


-- 






*Thanks & Regards*
Ajeet Kumar Gupt
+91-9311232332

-- 
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/CA%2BTqRssAtuug7nLH6BX9sb-6YoXLXriEoNHToby63-T209m8Bg%40mail.gmail.com.


Django dropdown data display issues in the control

2020-05-01 Thread Ajeet Kumar Gupt
> Hi,
>
> I am a beginner in Django and want to developing one assignment in django.
>
> Now, I am created one model category and subcategory. Based on category
> populate the data sub-category and data have saved like the below format.
>
> *Category = * Operations
>
> *Subcategory =* Category1,Category2,Category3,Category4
>
> Same like other categories.
> I want to display data in index.html page selection option like
>
> *Subcategory: * Category1
>  Category2
>  Category3
>
> e.g. I looking like this .
>
> [image: image.png]
>
> I tried to use split function but it is not working. Please help us its a
> really appreciated.
>
> My Code: How to split the values.
>
>
>   
>
> {% for subcat in all_subcats_keys %}
>
> {{subcat.subcategory }} option>
>
> {% endfor %}
>
>   
>
>
> *Current Scenario, data display likes *
> [image: image.png]
>
>
> *Thanks & Regards*
> Ajeet Kumar Gupt
> +91-9311232332
>

-- 
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/CA%2BTqRsv%2BRKe5MneRxSbH_TpGw4j9Wt65xA-JNNpsG%2Bx_VE0Wug%40mail.gmail.com.


Required Django Programmer for freelancer

2020-07-08 Thread Ajeet Kumar Gupt
Dear Team,

I require Django programmers for an HR portal like leave request, HRMS.

*System Requirements:*

*1. Main Database :* Main app only for the authentication purpose and
employee information take it from the oracle ebs system by API.

*2. Leave Application System:* User login and validate details from the
main app point no.1 apply the leave and send for the approver with history
details

*3. SCR application :* Here also a  approval and rejection process with
customized notification based on company profile.

*Note:* Single Sign On and single Employee Information no need to create in
every app for the user profile. I need to create the only Main App / Main
Database.

Any person have interested please let me know and give me the demo on zoom
meeting as soon as possible.



*Thanks & Regards*
Ajit

-- 
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/CA%2BTqRstOCEpZsnpq%3DyJkgqRRXY-UBqUMMxX%2BaM-Mt7Q-pBejoQ%40mail.gmail.com.


Re: Static not working on unix while working on windows

2020-07-08 Thread Ajeet Kumar Gupt
You tried to first run collectststic

On Mon, Jul 6, 2020, 10:20 PM ashish goyal 
wrote:

> Hi All,
>
> I have created a django app on windows and have used bootstrap navbar n
> other functions which are working good on windows.
>
> Same files I have imported on unix server then i am able to get all
> details but getting issue with css and js files saying below error
>
> *Refused to apply style from  because its MIME type ('text/html') is
> not a supported stylesheet MIME type, and strict MIME checking is enabled
> angular*
>
> I am using below script in windows which is working in windows but not on
> unix
>
> *{ % load static %}*
> * 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/D45C33B1-949B-4BBE-8338-8982F2A246BF%40gmail.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/CA%2BTqRsvCq0A7GuLyRADscU5%2BQOP4LNbYs-0BWCJhvjNpU_NUUQ%40mail.gmail.com.


Re: Python manage.py runserver error

2020-08-26 Thread Ajeet Kumar Gupt
Hi,

Install django in virtual environment.

Thanks

On Wed, Aug 26, 2020, 6:57 AM ROHINI PUNDE  wrote:

> Hi,
> while running "python manage.py runserver"  I got this type of error ,I am
> not understand how to to solve this problem.please help me out.
> find out on this attachment(error.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/CAO9_9ZZRDPCFb4FnGWNLxku8VTa0x3LNKvVtUFm%2BVT%3DJ2uTOvg%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/CA%2BTqRsthSWVK2XBfmafmvy7puQgQD%3DUSfzjDB2%3DA4-n6Pw4%3DDQ%40mail.gmail.com.


Re: creating a website with django

2020-08-28 Thread Ajeet Kumar Gupt
Hi,

Please take help from  this website. It's a very basic concept to start the
Django framework in one place and step by steps.

URL: https://www.djangopythoner.com/

Thanks & Regards





On Fri, Aug 28, 2020 at 7:35 PM sakshi jain  wrote:

> plz help me also
>
> On Fri, Aug 28, 2020, 19:23 Kamini Shukla 
> wrote:
>
>> i want to create a website with the help of django. pls some one help of
>> that.
>>
>> --
>> 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/2fd61f31-8604-422a-b091-e46cd9bc25d0n%40googlegroups.com
>> <https://groups.google.com/d/msgid/django-users/2fd61f31-8604-422a-b091-e46cd9bc25d0n%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/msgid/django-users/CAJhs3iP_YK4gCu48FkbDwSHx6bciQ%2BzZCS_N4RvWFQ71X%2BFEYA%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAJhs3iP_YK4gCu48FkbDwSHx6bciQ%2BzZCS_N4RvWFQ71X%2BFEYA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>


-- 






*Thanks & Regards*
Ajeet Kumar Gupt
+91-9311232332

-- 
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/CA%2BTqRsuDgry%3DD44HVMJr-G32o3Cf1_y8oL-YEM0vjJpxwOzUiQ%40mail.gmail.com.


Re: Django/python free Training

2020-12-18 Thread Ajeet Kumar Gupt
Interested

On Fri, Dec 18, 2020, 6:26 PM Python Class  wrote:

> Hi guys,
>
> I am manucho from Kenya and am good developer with django and python and i
> want to teach people what i know .I want to start a youtube channel for
> Django and python based tutorials ..If intrested you can message me here on
> concepts and projects you want covered and i will start immediately.
>
> Regards,
> Manucho.
>
> --
> 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/5c715780-23c4-4d31-9219-a1e7b92c14f1n%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/CA%2BTqRsvRjPVffvWdZt8T9vNoLTJqED9UNCY-QKv9eZq%3DtBnh-w%40mail.gmail.com.


Re: can Django replace PHP ?

2021-06-28 Thread Ajeet Kumar Gupt
Django is a best in web development as well most secure in comparison to
php?

On Mon, Jun 28, 2021, 7:09 PM Ahmed omar miladi 
wrote:

> today django is the best for all web application
>
> Le lun. 28 juin 2021 à 14:17, Krishna Adhikari  a
> écrit :
>
>> Hello all  my seniors
>>
>> I am doing Data Science programming (python) for 3 years now in my
>> organization I also have to develop a Web Platform to deeply ML models and
>> also to develop other web applications together.
>>
>> I searched a lot of information on google, but till now I did not make a
>> decision should I learn PHP or I can handle it all with Django?
>>
>> *can we solve all kinds of web application problems with Django without
>> learning PHP ?? *
>> *or PHP also recommended.*
>>
>> Thank you all 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/f2007209-a90e-4a08-8d03-b2b3a1007e1en%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/CAE3Dc2N6CWH5w%3DTEpZRbh7tGv2jc06xBUO4Ym9d8cUs%2BS_eORQ%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/CA%2BTqRsvXBgYjvpArmyCx4ANUHpm49jQBr9E5N1jD51EshA8Mkg%40mail.gmail.com.


Re: let the previous file as it is now i am doing another one and it is showing same problem

2019-07-23 Thread Ajeet Kumar Gupt
Dear Team,

I am very new in Django, I read tutorials of Django and python but I want
to start the development process with a very small application.

Like End User registration, end-user login. How to implement a little bit
confused.  I need a help from your side how to start and how to implement a
simple way.


Thanks

Ajeet




On Tue, Jul 23, 2019 at 10:56 AM gilwell muhati  wrote:

> Please have a look at this tutorial on how to retrieve data from models.
>
> http://www.learningaboutelectronics.com/Articles/How-to-retrieve-all-objects-of-a-database-table-in-Django.php
>
> You need to create a model in your models.py then use views.py to retrieve
> it.
> use a context in your views to pull multiple records  e.g
>
> destinations =  Destinations.objects.all()
> context = {
>  'destinations':destinations
> }
>
>
>
>
>
>
> *Regards,Gilwell Muhati | +254 710 739 116 | *
> *~~“The mind is its own place and in itself can make a heaven of hell, a
> hell of heaven…”~~John Milton *
>
>
> On Tue, Jul 23, 2019 at 9:20 AM Mukul Dharwala 
> wrote:
>
>>
>> --
> 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/CALO4FhFv53j5JMvFT%2Bgjp0bND30SkPofmtTGWJSMPmj_97u6cg%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CALO4FhFv53j5JMvFT%2Bgjp0bND30SkPofmtTGWJSMPmj_97u6cg%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>


-- 






*Thanks & Regards*
Ajeet Kumar Gupt
+91-9311232332

-- 
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/CA%2BTqRss2bO%2B4UXDKzNw53JCQzT3WUoUPhAa6EyE_Frk3SJTMJQ%40mail.gmail.com.


Re: let the previous file as it is now i am doing another one and it is showing same problem

2019-07-23 Thread Ajeet Kumar Gupt
Thanks for the prompt response.

On Tue, Jul 23, 2019 at 4:13 PM Lim Kai Wey  wrote:

> To Ajeet,
>
> I believe this tutorial may help you understand authentication
> implementations. It won’t ultimately be your end user registrations but
> it’s a basic start.
>
> Link:
>
> https://developer.mozilla.org/en-US/docs/Learn/Server-side/Django/Authentication
>
> Regards,
> Kai Wey
>
> On Tue, Jul 23, 2019 at 7:34 PM Ajeet Kumar Gupt 
> wrote:
>
>> Dear Team,
>>
>> I am very new in Django, I read tutorials of Django and python but I want
>> to start the development process with a very small application.
>>
>> Like End User registration, end-user login. How to implement a little bit
>> confused.  I need a help from your side how to start and how to implement a
>> simple way.
>>
>>
>> Thanks
>>
>> Ajeet
>>
>>
>>
>>
>> On Tue, Jul 23, 2019 at 10:56 AM gilwell muhati 
>> wrote:
>>
>>> Please have a look at this tutorial on how to retrieve data from models.
>>>
>>> http://www.learningaboutelectronics.com/Articles/How-to-retrieve-all-objects-of-a-database-table-in-Django.php
>>>
>>> You need to create a model in your models.py then use views.py to
>>> retrieve it.
>>> use a context in your views to pull multiple records  e.g
>>>
>>> destinations =  Destinations.objects.all()
>>> context = {
>>>  'destinations':destinations
>>> }
>>>
>>>
>>>
>>>
>>>
>>>
>>> *Regards,Gilwell Muhati | +254 710 739 116 | *
>>> *~~“The mind is its own place and in itself can make a heaven of hell, a
>>> hell of heaven…”~~John Milton *
>>>
>>>
>>> On Tue, Jul 23, 2019 at 9:20 AM Mukul Dharwala 
>>> wrote:
>>>
>>>>
>>>> --
>>> 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/CALO4FhFv53j5JMvFT%2Bgjp0bND30SkPofmtTGWJSMPmj_97u6cg%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/django-users/CALO4FhFv53j5JMvFT%2Bgjp0bND30SkPofmtTGWJSMPmj_97u6cg%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>
>>
>>>
>>
>> --
>>
>>
>>
>>
>>
>>
>> *Thanks & Regards*
>> Ajeet Kumar Gupt
>> +91-9311232332
>>
>> --
>> 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/CA%2BTqRss2bO%2B4UXDKzNw53JCQzT3WUoUPhAa6EyE_Frk3SJTMJQ%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CA%2BTqRss2bO%2B4UXDKzNw53JCQzT3WUoUPhAa6EyE_Frk3SJTMJQ%40mail.gmail.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/msgid/django-users/CAPcVkjifFrgRrUC-sw%2BE6t6MLG0tsLL%2B%3D2Z-c0-4cLTy-CF_Tw%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAPcVkjifFrgRrUC-sw%2BE6t6MLG0tsLL%2B%3D2Z-c0-4cLTy-CF_Tw%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>


-- 






*Thanks & Regards*
Ajeet Kumar Gupt
+91-9311232332

-- 
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/CA%2BTqRsupRsQeHhPb9YO7hxGA2%3D_8QTwPh%2BOXs80upTqMpwFPTg%40mail.gmail.com.


dlango MultiValueDictKeyError

2019-08-05 Thread Ajeet Kumar Gupt
Dear Team,

I am developing custom registration and login page for end-user but getting
the below error. Please find the views.py code also in the trail.


*MultiValueDictKeyError at /login/*

'username'

Request Method: GET
Request URL: http://127.0.0.1:8000/login/
Django Version: 2.2.3
Exception Type: MultiValueDictKeyError
Exception Value:

'username'

Exception Location:
C:\Python\Python37\lib\site-packages\django\utils\datastructures.py
in __getitem__, line 80
Python Executable: C:\Python\Python37\python.exe
Python Version: 3.7.3

-- 
*Views.py*
**

rom django.shortcuts import render
from django.contrib.auth.models import User
from django.http import HttpResponseRedirect
from .forms import RegisterForm
from django.conf import settings
from django.shortcuts import redirect
from django.contrib.auth.decorators import login_required
from django.contrib import messages
from django.contrib.auth import authenticate,login
from django.contrib import auth
from django.core.exceptions import ObjectDoesNotExist


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('index.html')
# 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})





def login_view(request):
username = request.POST['username']
password = request.POST['pass']
users = authenticate(request, username=username, password=password)
if users is not None:
login(request, users)
return redirect('welcome.html')
else:
return redirect('index.html')



def logout(request):
auth.logout(request)
return render(request, 'login.html')




*Thanks & Regards*
Ajeet Kumar Gupt
+91-9311232332

-- 
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/CA%2BTqRsvD7P8Mk4RCUUg-5%3DYTE7PjBnHyJA%3DVZowGgGoYQnyNKw%40mail.gmail.com.


Re: dlango MultiValueDictKeyError

2019-08-06 Thread Ajeet Kumar Gupt
Hi,

Thank you very much now issues have been resolved.



On Mon, Aug 5, 2019 at 6:14 PM Sipum Mishra  wrote:

> Hey Ajit,
>
> This error comes when You are trying to get username, passwords from the
> form.
> It is due to the below reason -
>
> In Login,
> You are using -> request.POST['username'] which will raise a KeyError
> exception if 'username' is not in request.POST.
>
> Instead use -> request.POST.get('username') which will return None if '
> username' is not in request.POST.
>
> Additionally, .get allows you to provide an additional parameter of a
> default value which is returned if the key is not in the dictionary.
>
> For example, request.POST.get('username', 'mydefaultvalue')
>
> Hope this helps. If any concern then let us know.
>
> On Mon, 5 Aug 2019 at 15:47, Ajeet Kumar Gupt 
> wrote:
>
>> Dear Team,
>>
>> I am developing custom registration and login page for end-user but
>> getting the below error. Please find the views.py code also in the trail.
>>
>>
>> *MultiValueDictKeyError at /login/*
>>
>> 'username'
>>
>> Request Method: GET
>> Request URL: http://127.0.0.1:8000/login/
>> Django Version: 2.2.3
>> Exception Type: MultiValueDictKeyError
>> Exception Value:
>>
>> 'username'
>>
>> Exception Location: 
>> C:\Python\Python37\lib\site-packages\django\utils\datastructures.py
>> in __getitem__, line 80
>> Python Executable: C:\Python\Python37\python.exe
>> Python Version: 3.7.3
>>
>> --
>> *Views.py*
>> **
>>
>> rom django.shortcuts import render
>> from django.contrib.auth.models import User
>> from django.http import HttpResponseRedirect
>> from .forms import RegisterForm
>> from django.conf import settings
>> from django.shortcuts import redirect
>> from django.contrib.auth.decorators import login_required
>> from django.contrib import messages
>> from django.contrib.auth import authenticate,login
>> from django.contrib import auth
>> from django.core.exceptions import ObjectDoesNotExist
>>
>>
>> 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('index.html')
>> # Login the user
>> #login(request, user)
>>     #def user_login(request):
>> # redirect to accounts page:
>> #return render(request, '/login.html')
>># return HttpResponseRedirect(return, '/login.html'

Re: dlango MultiValueDictKeyError

2019-08-06 Thread Ajeet Kumar Gupt
Hi,

Problem was in my code I was using the request.POST['username'] instead of
request.POST.get('username')

You have given the solutions and the same I have implemented.

Once again thanks to you if any issues let you know.

*Actually, I am very new in Django hardly 1 week back started. This is my
first project to start for the learning purpose and I try to implement a
document management system with the workflow approval process.  I need your
support and help while developing the application. Once the design part
completed will share with you.*

def login_view(request):
templates = 'welcome.html'
username = request.POST.get('username')
password = request.POST.get('pass')
user = authenticate(request, username=username, password=password)
if user is not None:
login(request, user)
return render(request, templates ,{'user' : user  })
else:
#return redirect('welcome.html')
messages.error(request, 'Login Failed! Invalid username and password.')
return render(request, 'login.html',{'user' : user  })














On Tue, Aug 6, 2019 at 8:55 PM DPM  wrote:

> Hey Ajit,
> Its Great.
> Can you please tell us what was the problem?
>
> On Tue, 6 Aug, 2019, 1:07 PM Ajeet Kumar Gupt, 
> wrote:
>
>> Hi,
>>
>> Thank you very much now issues have been resolved.
>>
>>
>>
>> On Mon, Aug 5, 2019 at 6:14 PM Sipum Mishra  wrote:
>>
>>> Hey Ajit,
>>>
>>> This error comes when You are trying to get username, passwords from the
>>> form.
>>> It is due to the below reason -
>>>
>>> In Login,
>>> You are using -> request.POST['username'] which will raise a KeyError
>>> exception if 'username' is not in request.POST.
>>>
>>> Instead use -> request.POST.get('username') which will return None if '
>>> username' is not in request.POST.
>>>
>>> Additionally, .get allows you to provide an additional parameter of a
>>> default value which is returned if the key is not in the dictionary.
>>>
>>> For example, request.POST.get('username', 'mydefaultvalue')
>>>
>>> Hope this helps. If any concern then let us know.
>>>
>>> On Mon, 5 Aug 2019 at 15:47, Ajeet Kumar Gupt 
>>> wrote:
>>>
>>>> Dear Team,
>>>>
>>>> I am developing custom registration and login page for end-user but
>>>> getting the below error. Please find the views.py code also in the trail.
>>>>
>>>>
>>>> *MultiValueDictKeyError at /login/*
>>>>
>>>> 'username'
>>>>
>>>> Request Method: GET
>>>> Request URL: http://127.0.0.1:8000/login/
>>>> Django Version: 2.2.3
>>>> Exception Type: MultiValueDictKeyError
>>>> Exception Value:
>>>>
>>>> 'username'
>>>>
>>>> Exception Location: 
>>>> C:\Python\Python37\lib\site-packages\django\utils\datastructures.py
>>>> in __getitem__, line 80
>>>> Python Executable: C:\Python\Python37\python.exe
>>>> Python Version: 3.7.3
>>>>
>>>> --
>>>> *Views.py*
>>>> **
>>>>
>>>> rom django.shortcuts import render
>>>> from django.contrib.auth.models import User
>>>> from django.http import HttpResponseRedirect
>>>> from .forms import RegisterForm
>>>> from django.conf import settings
>>>> from django.shortcuts import redirect
>>>> from django.contrib.auth.decorators import login_required
>>>> from django.contrib import messages
>>>> from django.contrib.auth import authenticate,login
>>>> from django.contrib import auth
>>>> from django.core.exceptions import ObjectDoesNotExist
>>>>
>>>>
>>>> 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():
>>>>

Re: form.is_valid() is always return false please help

2019-08-25 Thread Ajeet Kumar Gupt
Hi,

Please check the below solution.


[image: image.png]

On Thu, Aug 22, 2019 at 11:57 PM Shubham Chauhan <
shubham.chauhan...@gmail.com> wrote:

> form.is_valid() is always return false please help
>
> --
> 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/206e042a-738b-4491-8f4d-9c172f61e56d%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/206e042a-738b-4491-8f4d-9c172f61e56d%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>


-- 






*Thanks & Regards*
Ajeet Kumar Gupt
+91-9311232332

-- 
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/CA%2BTqRsshAee3kC%2BrYguaC8Z5X%3DcReWWhjEw1EDg%3DYBXChF9xjg%40mail.gmail.com.


Re: User Register form not validating or returning errors.

2019-08-25 Thread Ajeet Kumar Gupt
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
> 
> 
> 
> 
> 
> {% 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
> <https://groups.google.com/d/msgid/django-users/5a003506-de8d-4587-863d-3fc26e4c45c1%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>


-- 






*Thanks & Regards*
Ajeet Kumar Gupt
+91-9311232332

-- 
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/CA%2BTqRssQ_O3CRknqdev24W7PHWWH0Hd19%3DH-gH-UmSdrmiMyJA%40mail.gmail.com.


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
> <https://docs.djangoproject.com/en/2.2/ref/csrf/> 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
>
> <https://docs.djangoproject.com/en/dev/topics/templates/#django.template.backends.base.Template.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:
>
>>

Re: Django 2.2.6 fails to serve some static files in Windows 10

2019-10-02 Thread Ajeet Kumar Gupt
Hi,

Use the below code

href="{% static 'css/styles.css' %}"

On Wed, Oct 2, 2019 at 8:06 PM red sky  wrote:

> My system: Windows 10 1903. Python 3.7.4, 64 bit.
>
> My directory structure:
> %USERPROFILE%/Desktop/myproject/manage.py
> %USERPROFILE%/Desktop/myproject/some_app (...)
> %USERPROFILE%/Desktop/myproject/myproject/db.sqlite3
> %USERPROFILE%/Desktop/myproject/myproject/urls.py
> %USERPROFILE%/Desktop/myproject/myproject/static (...)
> %USERPROFILE%/Desktop/myproject/myproject/static/css (...)
> %USERPROFILE%/Desktop/myproject/myproject/media (...)
> %USERPROFILE%/Desktop/myproject/myproject/some_apps (...)
> %USERPROFILE%/Desktop/myproject/myproject/settings/
> %USERPROFILE%/Desktop/myproject/myproject/settings/__init__.py
> %USERPROFILE%/Desktop/myproject/myproject/settings/settings_base.py
> %USERPROFILE%/Desktop/myproject/myproject/settings/settings_devel.py
> %USERPROFILE%/Desktop/myproject/myproject/settings/settings_production.py
>
>
> My urls.py (last part):
> if ENVIRONMENT=="development":
> import debug_toolbar
> urlpatterns += [path('__debug__/',include (debug_toolbar.urls))]
> urlpatterns += static(MEDIA_URL,document_root=MEDIA_ROOT)
> urlpatterns += static(STATIC_URL,document_root=STATIC_ROOT)
> urlpatterns += router.urls
>
> My settings:
>
> STATIC_URL = '/static/'
> STATIC_ROOT = os.path.join(BASE_DIR , 'static')
> MEDIA_ROOT = BASE_DIR + '/media/'
> (...)
> MEDIA_URL='/media/'
>
> I also tried with and without the following setting in several variants:
> STATIFCILES_DIRS = ["","//",STATIC_ROOT,
> "%userprofile%\\Desktop\\myproject\\myproject\\"]
>
> The template: The error happens both with  href="/static/css/styles.css" and
> {% load static %} (...) href="{% static css/styles.css}" . I think the
> template is not the problem here.
>
> The error:"GET /static/css/styles.css HTTP/1.1" 404 1767
>
> The error takes place also with static requests (
> http://127.0.0.1:8000/static/css/styles.css)
>
> Strange behaviour:
> If I change the setting static_url to STATIC_URL = "static/" the css file
> is served. However, debug_toolbar ceases to serve her own static files and
> doesn't work anymore ("GET
> /myproject/static/debug_toolbar/img/ajax-loader.gif HTTP/1.1" 404 14554)
>
> I have tried many things, to no avail.
>
> 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-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/aa231cc0-c3bf-4d3d-8bf0-6578d1952eff%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/aa231cc0-c3bf-4d3d-8bf0-6578d1952eff%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>


-- 






*Thanks & Regards*
Ajeet Kumar Gupt
+91-9311232332

-- 
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/CA%2BTqRsu4Mdcirm67q-eBkyYhAGqFaSJb48Kz%3Dnu%3D9SbLm%3Dnq8A%40mail.gmail.com.


Re: My first django website

2019-10-07 Thread Ajeet Kumar Gupt
Do you have the file upload option . How to upload the multiple files at a
time.

On Sun, 6 Oct, 2019, 4:15 AM Ehab Al-Qabbani,  wrote:

> https://my-private-blog.herokuapp.com/
>
> Please try it
>
>
>
> Warmest Regards,
> Ehab
>
> --
> 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/DB7PR07MB388428ECD7DB6A10C8221A41AB980%40DB7PR07MB3884.eurprd07.prod.outlook.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/CA%2BTqRstRW-JqjowanUwQ4%3DTn%2BvGxj5Sh3_PUphcXpfoCk0R2dQ%40mail.gmail.com.


Python Email Parsing and Email Signature Extraction

2019-12-10 Thread Ajeet Kumar Gupt
Hi Team,

I need one help from python how to extract contact and email address from
Gmail signature in an excel sheet.

-- 






*Thanks & Regards*
Ajeet Kumar Gupt
+91-9311232332

-- 
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/CA%2BTqRsuq-V5osO1UhY38%2BwLWVB4GFX_g4m%3D8kSe5t%3DvL8O3c%2BA%40mail.gmail.com.


Re: Python Django Training

2020-02-03 Thread Ajeet Kumar Gupt
Hi Srikant,

Please add me also. +91-9311232332


On Mon, Feb 3, 2020 at 12:58 PM Avdesh Kumar Sharma <
avdeshsharma...@gmail.com> wrote:

> I am also interested to attend the training.
>
>
> Regards,
> Avdesh Kumar Sharma
>
>
> On Saturday, February 1, 2020 at 7:12:52 PM UTC+5:30, Srikanth K wrote:
>>
>> Hi,
>>
>> I am from Hyderabad. I am Python Developer by Profession. I am eager take
>> up any Python , Django Training (online Preferrable or Weekends). Members
>> who require can contact me or share me  there idea.
>>
>> Regards,
>> Srikanth.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/f2f3f2dc-ed49-45e0-844d-8e785fad1302%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/f2f3f2dc-ed49-45e0-844d-8e785fad1302%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>


-- 






*Thanks & Regards*
Ajeet Kumar Gupt
+91-9311232332

-- 
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/CA%2BTqRssMn7rOFJWZ22pYgJ%2Bke3JD2osxCgLkBknKDkTOZmmuhA%40mail.gmail.com.