Re: django-admin error

2019-08-18 Thread DPM
Hi,

Kindly do whatever some told to add in admin.py file above. Thats correct.
After that u can see in admin panel
..

And for heroku what  error you are getting plz share screenshot.
I can help you.

On Mon, 19 Aug, 2019, 2:36 AM Gil Obradors,  wrote:

> 1.-Plese detail more : "But it not run" ?  Any error?  Admin screen
> withous the model?
> You can try doing with the same with decorator and class:
>
> from django.contrib import admin
>
> @admin.register(Pacientes)
> class PacientesAdmin(admin.ModelAdmin)
> pass
>
> Share errors, screen, behaveour...
>
>
> 2.- I don't know heroku but maybe for test/demo your selfPC it could be
> easy for starting...
> Port forwarding and go!
>
>
>
>
> Bests djangos
>
> Missatge de Gabriel Araya Garcia  del dia
> dg., 18 d’ag. 2019 a les 21:41:
>
>> Hi Daniel:
>> I have build a little app in Django, but i have two problems:
>> 1) I can not see the tables in ADMIN, but nevertheless y put in admin.py:
>> from .models import Pacientes
>> admin.site.register(Pacientes)
>>
>> But it not run.
>>
>> 2) I can not upload my project to HEROKU, I've follow all the steps for
>> to do this, but not run
>> Do you know some cpanel to upload my app for demo only (it have 120
>> records)
>>
>> Please, can you help about this?
>>
>> Thanks
>> (excusme my english, my native language is spanish)
>>
>> El sáb., 17 ago. 2019 a las 18:38, Daniel Agbaji ()
>> escribió:
>>
>>> Please check to see it you got install Django properly with the version
>>> of Python you are using.
>>>
>>> On Sat, Aug 17, 2019, 4:38 PM Muhammad Nadeem 
>>> wrote:
>>>
 FIRST U NEED TO START A NEW PROJECT USING FOLLOWING CODE:
django-admin startproject mysite
 WHERE "mysite" is the name of your project. you can change this name as
 you desired.


 if further u have any error fell free ping me


 On Sun, Aug 18, 2019 at 1:32 AM Naty Mina  wrote:

> hi, i'm new in django and trying to create my first project
> i followed the documentation and when i try to execute the
> django-admin startproject mysite i get error that 'no django settings
> specified' and to try 'django-admin.py help' instead for usage.
> the problem is when i try to do so, i get again the same error message
> i need help with that.
> i attached file so you can see
> *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/1690dca2-2728-452e-81fe-1458af63ba95%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/CALYW77hm8aK%2BNPpfPPexB10ikmQ7Y%2BzezZZULe5mDvgLyVYSSQ%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/CAEnL_2nXTu13StMpfL8EQR6zwhZ6TmpW8RhHYoH69cc-9xWAog%40mail.gmail.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/CAKVvSDAW0r1hJ7muJ0cEB9NhTwhWVq1O5yCMo1%3D7OsV04nGLtA%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.
> 

Re: Hi, can any one help me please.

2019-08-12 Thread DPM
Can u plz show the code where this error coming...

On Mon, 12 Aug, 2019, 5:00 PM goitom negash,  wrote:

> the following error is displayed when i try to write a function named as
> display_laptop to display the available laptops in the backend.
> NoReverseMatch at /
>
> Reverse for 'display_laptop' not found. 'display_laptop' is not a valid view 
> function or pattern name.
>
> Request Method: GET
> Request URL: http://127.0.0.1:8000/
> Django Version: 2.2.3
> Exception Type: NoReverseMatch
> Exception Value:
>
> Reverse for 'display_laptop' not found. 'display_laptop' is not a valid view 
> function or pattern name.
>
> Exception Location: 
> C:\Users\Goitom\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\urls\resolvers.py
> in _reverse_with_prefix, line 668
> Python Executable:
> C:\Users\Goitom\AppData\Local\Programs\Python\Python37-32\python.exe
> Python Version: 3.7.4
> Python Path:
>
> ['C:\\Users\\Goitom\\Desktop\\shop',
>  
> 'C:\\Users\\Goitom\\AppData\\Local\\Programs\\Python\\Python37-32\\python37.zip',
>  'C:\\Users\\Goitom\\AppData\\Local\\Programs\\Python\\Python37-32\\DLLs',
>  'C:\\Users\\Goitom\\AppData\\Local\\Programs\\Python\\Python37-32\\lib',
>  'C:\\Users\\Goitom\\AppData\\Local\\Programs\\Python\\Python37-32',
>  'C:\\Users\\Goitom\\AppData\\Roaming\\Python\\Python37\\site-packages',
>  
> 'C:\\Users\\Goitom\\AppData\\Local\\Programs\\Python\\Python37-32\\lib\\site-packages']
>
> Server time: Mon, 12 Aug 2019 11:12:59 +
>
> --
> 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/d81e5cbf-ebf1-46f7-9a8f-8406440a0f4b%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/CAGHZBzx9yXL2euU8HKCjuBZ-jOgv26Lo5Y85v%3D_EnaO9a3M7mA%40mail.gmail.com.


Re: dlango MultiValueDictKeyError

2019-08-06 Thread DPM
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():
>>> 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')
>>>
>>>
>>>
>>>
>>> 

Re: Enter valid date error

2019-08-06 Thread DPM
Hey Ani,

Change format_key = DATE_INPUT_FORMATS.
Omit the quotes. Then will work fine.


On Tue, 6 Aug, 2019, 11:59 AM ANi,  wrote:

> I've change the default date field widget slightly,
> but only like this and also define the DATE_INPUT_FORMATS
>
>
>
> class DateInput(DateTimeBaseInput):
> input_type = 'date'
> format_key = 'DATE_INPUT_FORMATS'
>
>
> DATE_INPUT_FORMATS = [
> '%Y-%m-%d',
> ]
>
>
> but still get error on the date field, only success at the first time
> after I restart the server
>
> any reason could be?
>
> --
> 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/6d5257f5-e7aa-41ff-a0f7-8d4936e73167%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/CAGHZBzymjKTT0cAWna6ezf%3DsPmJAvkkDTd0i9oDjK2pqpm%2Bj6A%40mail.gmail.com.


Re: dlango MultiValueDictKeyError

2019-08-05 Thread DPM
Hey Vishal,

I don't think this error comes for what you told. The error raises for
which I v mentioned above.

And I agree with u as that is also have to do. As he did import auth so
need to write auto.authentication.


On Mon, 5 Aug, 2019, 8:54 PM vishal singh, 
wrote:

>  //users = authenticate(request, username=username, password=password)
>
> you have to use Auth keyword to remove this exception as right now it is
> treated as a dict.
>
>  users = Auth.authenticate(request, username=username, password=password)
>
> On Mon, 5 Aug 2019 at 15:46, 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')
>># 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
>>