http://localhost:8000/admin/ is not working

2020-06-16 Thread Ifeanyi Chielo
Please can anyone help me resolve this issue. 
the http://localhost:8000/admin/ is not working and returns an error below

TypeError at /admin/Cannot mix str and non-str argumentsRequest Method:
GETRequest URL:
http://localhost:8000/admin/Django Version:
2.1.5Exception Type:
TypeErrorException Value:
Cannot mix str and non-str argumentsException Location:
C:\Users\IFEANYI 
CHIELO\AppData\Local\Programs\Python\Python37\lib\urllib\parse.py in 
_coerce_args, line 120Python Executable:
C:\Users\IFEANYI 
CHIELO\AppData\Local\Programs\Python\Python37\python.exePython Version:
3.7.2Python Path:
['C:\\Users\\IFEANYI CHIELO\\divinerest', 'C:\\Users\\IFEANYI ' 
'CHIELO\\AppData\\Local\\Programs\\Python\\Python37\\python37.zip', 
'C:\\Users\\IFEANYI 
CHIELO\\AppData\\Local\\Programs\\Python\\Python37\\DLLs', 
'C:\\Users\\IFEANYI 
CHIELO\\AppData\\Local\\Programs\\Python\\Python37\\lib', 
'C:\\Users\\IFEANYI CHIELO\\AppData\\Local\\Programs\\Python\\Python37', 
'C:\\Users\\IFEANYI ' 
'CHIELO\\AppData\\Local\\Programs\\Python\\Python37\\lib\\site-packages']Server 
time:
Tue, 16 Jun 2020 06:40:44 +
Traceback Switch to copy-and-paste view <http://localhost:8000/admin/#>

   - C:\Users\IFEANYI 
   
CHIELO\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\handlers\exception.py
 in inner
   1. response = get_response(request) ...
   ▶ Local vars <http://localhost:8000/admin/#>
   - C:\Users\IFEANYI 
   
CHIELO\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\handlers\base.py
 in _get_response
   1. response = self.process_exception_by_middleware(e, request) ...
   ▶ Local vars <http://localhost:8000/admin/#>
   - C:\Users\IFEANYI 
   
CHIELO\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\handlers\base.py
 in _get_response
   1. response = wrapped_callback(request, *callback_args, 
  **callback_kwargs) ...
   ▶ Local vars <http://localhost:8000/admin/#>
   - C:\Users\IFEANYI 
   
CHIELO\AppData\Local\Programs\Python\Python37\lib\site-packages\django\contrib\admin\sites.py
 in wrapper
   1. return self.admin_view(view, cacheable)(*args, **kwargs) ...
   ▶ Local vars <http://localhost:8000/admin/#>
   - C:\Users\IFEANYI 
   
CHIELO\AppData\Local\Programs\Python\Python37\lib\site-packages\django\utils\decorators.py
 in _wrapped_view
   1. response = view_func(request, *args, **kwargs) ...
   ▶ Local vars <http://localhost:8000/admin/#>
   - C:\Users\IFEANYI 
   
CHIELO\AppData\Local\Programs\Python\Python37\lib\site-packages\django\views\decorators\cache.py
 in _wrapped_view_func
   1. response = view_func(request, *args, **kwargs) ...
   ▶ Local vars <http://localhost:8000/admin/#>
   - C:\Users\IFEANYI 
   
CHIELO\AppData\Local\Programs\Python\Python37\lib\site-packages\django\contrib\admin\sites.py
 in inner
   1. reverse('admin:login', current_app=self.name) ...
   ▶ Local vars <http://localhost:8000/admin/#>
   - C:\Users\IFEANYI 
   
CHIELO\AppData\Local\Programs\Python\Python37\lib\site-packages\django\contrib\auth\views.py
 in redirect_to_login
   1. return HttpResponseRedirect(urlunparse(login_url_parts)) ...
   ▶ Local vars <http://localhost:8000/admin/#>
   - C:\Users\IFEANYI 
   CHIELO\AppData\Local\Programs\Python\Python37\lib\urllib\parse.py in 
urlunparse
   1. _coerce_args(*components)) ...
   ▶ Local vars <http://localhost:8000/admin/#>
   - C:\Users\IFEANYI 
   CHIELO\AppData\Local\Programs\Python\Python37\lib\urllib\parse.py in 
_coerce_args
   1. raise TypeError("Cannot mix str and non-str arguments") ...
   ▶ Local vars <http://localhost:8000/admin/#>
   
Request informationUSER

AnonymousUser
GET

No GET data
POST

No POST data
FILES

No FILES data
COOKIES

-- 
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/f46f8e4c-f716-4b4f-a1a7-c16d5a819e8dn%40googlegroups.com.


Model Arithmetic Operation

2020-06-02 Thread Ifeanyi Chielo
Dear all,

Hello, please can someone help me with the code to subtract  'b' from 'a' 
as shown below


a = Soapprod.objects.aggregate(Sum('Serial_White_Guava'))

 

b = Soapsales.objects.aggregate(Sum('Serial_White_Guava'))

 

class Soapprod (models.Model):

id = models.AutoField(primary_key=True)

Serial_White_Guava  = models.PositiveIntegerField()

Serial_White_Premium= models.PositiveIntegerField()

Soft_Flower_Body_Wash   = models.PositiveIntegerField()

Soft_Flower_Fresh   = models.PositiveIntegerField()

Soft_Flower_Orange_Lightening   = models.PositiveIntegerField()

Soft_Flower_Carot_Lightening= models.PositiveIntegerField()

Soft_Flower_Papaya_Extract  = models.PositiveIntegerField()

Soft_Flower_Extra_Lightening= models.PositiveIntegerField()

Serial_White_Papaya_4in1= models.PositiveIntegerField()

date= models.DateField(default
 = date.today)

   

def __str__(self):

return self.serial_white_guava

 

class Soapsales (Soapprod):

SOAP_MARKETER_STATUS = (

('M', 'Marketers'),

('D', 'Distributor'),

('A', 'Distributor_B'),

('B', 'Distributor_C'),

)

soap_marketer_status = models.CharField(max_length=1, choices
=SOAP_MARKETER_STATUS)

 

 

-- 
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/1c978c25-cbb4-41bd-ab01-b49aa6365826%40googlegroups.com.


Re: Regarding redering data in html templates

2020-05-27 Thread Ifeanyi Chielo
at the html file of your template folder, use something like
{{table1.skin_care1}}
{{table1.skin_care2}} etc

note skin_care1, skin_care etc are fields in your model table 'table1'

Dr. Chielo C. Ifeanyi
Chief Programmer,
Head Webometrics Section
ICT Unit, UNN
08032366433, 08154804230
ifeanyi.chi...@unn.edu.ng
http://www.unn.edu.ng/users/ifeanyichielo 



On Mon, May 25, 2020 at 4:05 PM Karthiki Chowdary <
karthichowdary...@gmail.com> wrote:

> Hi i was beginner in django and i have a small query in templates.
> For suppose in the home page of any client browser if we have a button
> like SKINCARE or HEALTH CARE and if we click on that buttons we need to get
> the data of all skin care products companies logos/ health care companies
> logos. For that how i can render data in dictionaries suppose i want to
> render a static data how can i or i want or render a dynamic data how can i
> do that with dictionaries so other better option. Please help me out in this
>
> --
> 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/f2306e60-f48f-4e47-959c-763e9659182b%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/CAOcS8H17YqSsVUpHor0%2BWSeq_WJvP5z3Gac33ZPTJD47ScG92g%40mail.gmail.com.


Issue with CRUD Operation

2020-05-24 Thread Ifeanyi Chielo
Hello,
I performed a CRUD operation and every thing is working well except two 
things
1. my insert form does not clear the text boxes after saving a record
2. my delete operation renders an error page after deleting a record with a 
message ''DoesNotExist at /delete/3/" or "AttributeError at /delete/6/" 
example of the error messages are  shown below. i also attached view.py, 
model.py and template file

DoesNotExist at /delete/3/

Soapprod matching query does not exist.

*Request Method:*

POST

*Request URL:*

http://localhost:8000/delete/3/

*Django Version:*

2.1.5

*Exception Type:*

DoesNotExist

*Exception Value:*

Soapprod matching query does not exist.

*Exception Location:*

C:\Users\IFEANYI 
CHIELO\AppData\Local\Programs\Python\Python37\lib\site-packages\django\db\models\query.py
 
in get, line 399

*Python Executable:*

C:\Users\IFEANYI CHIELO\AppData\Local\Programs\Python\Python37\python.exe

*Python Version:*

3.7.2

*Python Path:*

['C:\\Users\\IFEANYI CHIELO\\divinecrown',

 'C:\\Users\\IFEANYI '

 'CHIELO\\AppData\\Local\\Programs\\Python\\Python37\\python37.zip',

 'C:\\Users\\IFEANYI 
CHIELO\\AppData\\Local\\Programs\\Python\\Python37\\DLLs',

 'C:\\Users\\IFEANYI 
CHIELO\\AppData\\Local\\Programs\\Python\\Python37\\lib',

 'C:\\Users\\IFEANYI CHIELO\\AppData\\Local\\Programs\\Python\\Python37',

 'C:\\Users\\IFEANYI '

 'CHIELO\\AppData\\Local\\Programs\\Python\\Python37\\lib\\site-packages']

*Server time:*

Mon, 25 May 2020 00:03:25 +


or


AttributeError at /delete/6/

'str' object has no attribute 'get'

*Request Method:*

POST

*Request URL:*

http://localhost:8000/delete/6/

*Django Version:*

2.1.5

*Exception Type:*

AttributeError

*Exception Value:*

'str' object has no attribute 'get'

*Exception Location:*

C:\Users\IFEANYI 
CHIELO\AppData\Local\Programs\Python\Python37\lib\site-packages\django\middleware\clickjacking.py
 
in process_response, line 26

*Python Executable:*

C:\Users\IFEANYI CHIELO\AppData\Local\Programs\Python\Python37\python.exe

*Python Version:*

3.7.2

*Python Path:*

['C:\\Users\\IFEANYI CHIELO\\divinecrown',

 'C:\\Users\\IFEANYI '

 'CHIELO\\AppData\\Local\\Programs\\Python\\Python37\\python37.zip',

 'C:\\Users\\IFEANYI 
CHIELO\\AppData\\Local\\Programs\\Python\\Python37\\DLLs',

 'C:\\Users\\IFEANYI 
CHIELO\\AppData\\Local\\Programs\\Python\\Python37\\lib',

 'C:\\Users\\IFEANYI CHIELO\\AppData\\Local\\Programs\\Python\\Python37',

 'C:\\Users\\IFEANYI '

 'CHIELO\\AppData\\Local\\Programs\\Python\\Python37\\lib\\site-packages']

*Server time:*

Mon, 25 May 2020 00:09:23 +

-- 
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/b43b280d-ab19-4620-8544-133c897396f0%40googlegroups.com.

{% extends "base.html" %}
{% load crispy_forms_tags %}


{% block content %}

{% csrf_token %}


{{form.date|as_crispy_field}}


{{form.Serial_White_Guava|as_crispy_field}} 


{{form.Serial_White_Premium|as_crispy_field}}


{{form.Soft_Flower_Body_Wash|as_crispy_field}} 


{{form.Soft_Flower_Fresh|as_crispy_field}}


{{form.Soft_Flower_Orange_Lightening|as_crispy_field}} 


{{form.Soft_Flower_Carot_Lightening|as_crispy_field}} 


{{form.Soft_Flower_Papaya_Extract|as_crispy_field}}


{{form.Soft_Flower_Extra_Lightening|as_crispy_field}} 


{{form.Serial_White_Papaya_4in1|as_crispy_field}}





Submit



 Back to list





{% endblock content %}# from django.shortcuts import render
# from .models import Postrec
# from .forms import ProductForm

# # Create your views here.

# # Create your views here.
# from django.views.generic import TemplateView

# class HomePageView (TemplateView):
# template_name = 'home.html'
# class AboutPageView (TemplateView):
# template_name = 'about.html'
# #from django.shortcuts import render
# class CreatepostPageView (TemplateView):
# template_name = 'createpost.html'

from django.http import HttpResponseRedirect
# from django.shortcuts import redirect
from django.shortcuts import render
from .models import Soapprod
from .forms import StaffrecForm, SoapprodForm
from django.views.generic import TemplateView

# def HomePageView (request, *args, **kwargs):
#  return render(request,"home.html", {})
def Basep_view (request,*args, **kwargs):
 return render(request,"basep.html", {})
def Namev_view (request,*args, *

Re: Tablespace is missing for a table from storage engine InnoDB

2020-05-17 Thread Ifeanyi Chielo
thanks, I will go through it

Dr. Chielo C. Ifeanyi
Chief Programmer,
Head Webometrics Section
ICT Unit, UNN
08032366433, 08154804230
ifeanyi.chi...@unn.edu.ng
http://www.unn.edu.ng/users/ifeanyichielo <http://www.unn.edu.ng>



On Sun, May 17, 2020 at 12:40 PM Kasper Laudrup 
wrote:

> Hi Ifeanyi,
>
> On 17/05/2020 13.35, Ifeanyi Chielo wrote:
> > Dear all
> > I am unable to access my phpmyadmin  tables either via django or
> > directtly, I always meet this error. " #1030 - Got error 194 "Tablespace
> > is missing for a table" from storage engine InnoDB"
> > Please I need your assistance
> >
>
> I think you would have a much better chance of getting assistance here:
>
> https://www.phpmyadmin.net/support/
>
> Kind regards,
>
> Kasper Laudrup
>
> > --
> > 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
> > <mailto:django-users+unsubscr...@googlegroups.com>.
> > To view this discussion on the web visit
> >
> https://groups.google.com/d/msgid/django-users/565b0156-b1f2-4c34-8e04-55081573bb2a%40googlegroups.com
> > <
> https://groups.google.com/d/msgid/django-users/565b0156-b1f2-4c34-8e04-55081573bb2a%40googlegroups.com?utm_medium=email_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/56425dfd-3e17-c21f-3bb6-d765ccc1d82e%40stacktrace.dk
> .
>

-- 
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/CAOcS8H0rCCDuoFHD8xQb7z%3D6CSS1Yvexnn1bPKq9O1Le6ZC_aA%40mail.gmail.com.


Tablespace is missing for a table from storage engine InnoDB

2020-05-17 Thread Ifeanyi Chielo
Dear all
I am unable to access my phpmyadmin  tables either via django or directtly, 
I always meet this error. " #1030 - Got error 194 "Tablespace is missing 
for a table" from storage engine InnoDB"
Please I need your assistance

-- 
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/565b0156-b1f2-4c34-8e04-55081573bb2a%40googlegroups.com.


Re: django doughts

2020-04-14 Thread Ifeanyi Chielo
it is like apps urls.py file is missing, you need to include your entire 
code for easier assistance

On Sunday, April 12, 2020 at 1:37:24 PM UTC+1, rama prakash y wrote:
>
> Hi can u plz tell me how can solve the pollsapp development in  django 
> project. I had complete my pollsapp development project in Django 
> documentation like that guidance.but i have browser error .
>

-- 
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/44e293ea-153a-4c9e-adf1-c5b6dba52199%40googlegroups.com.


Re: Looking for Django developers to work on a new and an existing project with our team

2020-04-07 Thread Ifeanyi Chielo
I am interested but I need to gather more experiences before joining such
teams, I am new in django though not new in app development
Dr. Chielo C. Ifeanyi
Chief Programmer,
Head Webometrics Section
ICT Unit, UNN
08032366433, 08154804230
ifeanyi.chi...@unn.edu.ng
http://www.unn.edu.ng/users/ifeanyichielo 



On Tue, Apr 7, 2020 at 5:10 PM Lax Nayak  wrote:

> Hi Everyone,
>
> Thank you everyone for your interest.
>
> Can the interested candidates fill out the below application:
> Please fill out this form : https://forms.gle/2FTHsUzzEuydXJ7v5
>
>
> On Sunday, March 29, 2020 at 11:27:17 PM UTC+5:30, Lax Nayak wrote:
>>
>> I am looking for a django developer who has expertise in building
>> enterprise grade solutions.
>>
>>
>> --
> 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/ef15fa54-7576-421b-81ce-10f0e8ea0962%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/CAOcS8H1YUKSHySmqMuRbU5G%2BOWSCgfvZtM%2BqjG_FSBM%3DWPvZ5w%40mail.gmail.com.


Re: Working with forms

2020-04-05 Thread Ifeanyi Chielo
Thanks to you all, I finally resolved the matter. I discovered it was just
of a mix up of ModelForm and ordinary Django forms, though I enjoyed the
teething challenges as a new django user
Dr. Chielo C. Ifeanyi
Chief Programmer,
Head Webometrics Section
ICT Unit, UNN
08032366433, 08154804230
ifeanyi.chi...@unn.edu.ng
http://www.unn.edu.ng/users/ifeanyichielo 



On Mon, Apr 6, 2020 at 12:04 AM Maro Okegbero Samuel 
wrote:

> Port your code back to the initial state it was when you asked the
> question and on the template change
>  *{{form}}* to *{{form.as_p}}*
>
>
>> --
> 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/063525f8-c177-47d6-b849-52240522ae4f%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/CAOcS8H2%2BtMxewMDAm6s%3DAQB6L%2BYCMTUaPHpyrr5A20u4z1vP2w%40mail.gmail.com.


Re: Working with forms

2020-04-05 Thread Ifeanyi Chielo
Please I am still left with the AttributeError, The form is now publishing
fully and very well but it cannot save to the MySQL table. below is the
error details and the recent code of view.py
AttributeError at /namev/

'NameForm' object has no attribute 'save'

Request Method: POST
Request URL: http://localhost:8000/namev/
Django Version: 2.1.5
Exception Type: AttributeError
Exception Value:

'NameForm' object has no attribute 'save'

Exception Location: C:\Users\IFEANYI CHIELO\divinecrownapp\pages\views.py
in Namev_view, line 17
Python Executable: C:\Users\IFEANYI
CHIELO\AppData\Local\Programs\Python\Python37\python.exe
Python Version: 3.7.2
Python Path:

['C:\\Users\\IFEANYI CHIELO\\divinecrownapp',
 'C:\\Users\\IFEANYI '
 'CHIELO\\AppData\\Local\\Programs\\Python\\Python37\\python37.zip',
 'C:\\Users\\IFEANYI CHIELO\\AppData\\Local\\Programs\\Python\\Python37\\DLLs',
 'C:\\Users\\IFEANYI CHIELO\\AppData\\Local\\Programs\\Python\\Python37\\lib',
 'C:\\Users\\IFEANYI CHIELO\\AppData\\Local\\Programs\\Python\\Python37',
 'C:\\Users\\IFEANYI '
 'CHIELO\\AppData\\Local\\Programs\\Python\\Python37\\lib\\site-packages']

Server time: Sun, 5 Apr 2020 19:46:34 +
CODE FOR VIEW.PY
ef Namev_view (request):
if request.method == 'POST':
form = NameForm(request.POST)
if form.is_valid():
form.save()
return HttpResponseRedirect('/namev/')
else:
form = NameForm()
return render(request, 'namev.html', {'form': form})

Dr. Chielo C. Ifeanyi
Chief Programmer,
Head Webometrics Section
ICT Unit, UNN
08032366433, 08154804230
ifeanyi.chi...@unn.edu.ng
http://www.unn.edu.ng/users/ifeanyichielo <http://www.unn.edu.ng>



On Sat, Apr 4, 2020 at 3:21 PM Luqman Shofuleji 
wrote:

> Okay, now the new error is that is not seeing that 'form' for the get
> request,
> you need to also add  form = NameForm () before the if statement "if
> request.method == 'POST' " to handle the page get request.
>
>
>
> On Sat, Apr 4, 2020, 12:33 PM Ifeanyi Chielo 
> wrote:
>
>> Thanks a lot,
>> I did as you said and I encountered the error message below:
>> UnboundLocalError at /namev/
>>
>> local variable 'form' referenced before assignment
>>
>> Request Method: GET
>> Request URL: http://localhost:8000/namev/
>> Django Version: 2.1.5
>> Exception Type: UnboundLocalError
>> Exception Value:
>>
>> local variable 'form' referenced before assignment
>>
>> Exception Location: C:\Users\IFEANYI
>> CHIELO\divinecrownapp\pages\views.py in Namev_view, line 42
>> Python Executable: C:\Users\IFEANYI
>> CHIELO\AppData\Local\Programs\Python\Python37\python.exe
>> Python Version: 3.7.2
>> Python Path:
>>
>> ['C:\\Users\\IFEANYI CHIELO\\divinecrownapp',
>>  'C:\\Users\\IFEANYI '
>>  'CHIELO\\AppData\\Local\\Programs\\Python\\Python37\\python37.zip',
>>  'C:\\Users\\IFEANYI 
>> CHIELO\\AppData\\Local\\Programs\\Python\\Python37\\DLLs',
>>  'C:\\Users\\IFEANYI 
>> CHIELO\\AppData\\Local\\Programs\\Python\\Python37\\lib',
>>  'C:\\Users\\IFEANYI CHIELO\\AppData\\Local\\Programs\\Python\\Python37',
>>  'C:\\Users\\IFEANYI '
>>  'CHIELO\\AppData\\Local\\Programs\\Python\\Python37\\lib\\site-packages']
>>
>> Server time: Sat, 4 Apr 2020 11:27:07 +
>> Dr. Chielo C. Ifeanyi
>> Chief Programmer,
>> Head Webometrics Section
>> ICT Unit, UNN
>> 08032366433, 08154804230
>> ifeanyi.chi...@unn.edu.ng
>> http://www.unn.edu.ng/users/ifeanyichielo <http://www.unn.edu.ng>
>>
>>
>>
>> On Sat, Apr 4, 2020 at 10:09 AM Luqman Shofuleji 
>> wrote:
>>
>>> In def Namev_view under views.py, include form in the return parameter
>>> and see if that resolves the issue
>>>
>>> return render(request, 'namev.html', {'form':form})
>>>
>>>
>>>
>>> On Sat, Apr 4, 2020, 1:35 AM Ifeanyi Chielo 
>>> wrote:
>>>
>>>> Hello,I developed a form with a single field, but this form displays
>>>> only the submit button at the browser as shown in the image below. Please
>>>> how can I correct this and also  save the field to the MySQL table.  My
>>>> code is also shown below
>>>>
>>>> [image: django form.png]
>>>>
>>>> View.py
>>>>
>>>> from django.http import HttpResponseRedirect
>>>>
>>>> from django.shortcuts import render
>>>>
>>>> from .models import Namerec
>>>>
>>>> from .forms import NameForm
>>>>
>>>> from django.views.generic import TemplateView
>>>>
>>>>
>>>>
>>>> d

Re: Working with forms

2020-04-05 Thread Ifeanyi Chielo
Thanks
Dr. Chielo C. Ifeanyi
Chief Programmer,
Head Webometrics Section
ICT Unit, UNN
08032366433, 08154804230
ifeanyi.chi...@unn.edu.ng
http://www.unn.edu.ng/users/ifeanyichielo <http://www.unn.edu.ng>



On Sun, Apr 5, 2020 at 6:35 PM Joshua Kayode 
wrote:

> Ask questions here for immediate and detailed response djangoafrica.com
> and join the WhatsApp group, a community of professional django developers
>
> Group1
> https://chat.whatsapp.com/IgJcwnZR9sr1Jatc5jnSx9
>
> Group2:
> https://chat.whatsapp.com/DfOLbncTDkIKAvcm5lLm2Y
>
> Django africa is a community of django developers
>
> Excellence for all....
>
> On Sun, Apr 5, 2020, 3:22 PM Ifeanyi Chielo 
> wrote:
>
>> I tried using the form. save() but it gave the same error message as
>> with NameForm.save()
>> Dr. Chielo C. Ifeanyi
>> Chief Programmer,
>> Head Webometrics Section
>> ICT Unit, UNN
>> 08032366433, 08154804230
>> ifeanyi.chi...@unn.edu.ng
>> http://www.unn.edu.ng/users/ifeanyichielo <http://www.unn.edu.ng>
>>
>>
>>
>> On Sun, Apr 5, 2020 at 3:06 PM KONE GOMPOU LOUA ALASSANE <
>> gompou.k...@uvci.edu.ci> wrote:
>>
>>> Use form. save() because you asigned NameForm to form like
>>>
>>> Le dim. 5 avr. 2020 à 14:04, Ifeanyi Chielo 
>>> a écrit :
>>>
>>>> I added the NameForm.Save() attribute and I had an AttributeError
>>>> message thus:
>>>> AttributeError at /namev/
>>>>
>>>> type object 'NameForm' has no attribute 'save'
>>>>
>>>> Request Method: POST
>>>> Request URL: http://localhost:8000/namev/
>>>> Django Version: 2.1.5
>>>> Exception Type: AttributeError
>>>> Exception Value:
>>>>
>>>> type object 'NameForm' has no attribute 'save'
>>>>
>>>> Exception Location: C:\Users\IFEANYI
>>>> CHIELO\divinecrownapp\pages\views.py in Namev_view, line 16
>>>> Python Executable: C:\Users\IFEANYI
>>>> CHIELO\AppData\Local\Programs\Python\Python37\python.exe
>>>> Python Version: 3.7.2
>>>> Python Path:
>>>>
>>>> ['C:\\Users\\IFEANYI CHIELO\\divinecrownapp',
>>>>  'C:\\Users\\IFEANYI '
>>>>  'CHIELO\\AppData\\Local\\Programs\\Python\\Python37\\python37.zip',
>>>>  'C:\\Users\\IFEANYI 
>>>> CHIELO\\AppData\\Local\\Programs\\Python\\Python37\\DLLs',
>>>>  'C:\\Users\\IFEANYI 
>>>> CHIELO\\AppData\\Local\\Programs\\Python\\Python37\\lib',
>>>>  'C:\\Users\\IFEANYI CHIELO\\AppData\\Local\\Programs\\Python\\Python37',
>>>>  'C:\\Users\\IFEANYI '
>>>>  'CHIELO\\AppData\\Local\\Programs\\Python\\Python37\\lib\\site-packages']
>>>>
>>>> Server time: Sun, 5 Apr 2020 13:59:01 +
>>>> Dr. Chielo C. Ifeanyi
>>>> Chief Programmer,
>>>> Head Webometrics Section
>>>> ICT Unit, UNN
>>>> 08032366433, 08154804230
>>>> ifeanyi.chi...@unn.edu.ng
>>>> http://www.unn.edu.ng/users/ifeanyichielo <http://www.unn.edu.ng>
>>>>
>>>>
>>>>
>>>> On Sun, Apr 5, 2020 at 2:45 PM Alejandro Avendano <
>>>> aavendan...@gmail.com> wrote:
>>>>
>>>>> Hi in the first version, you had:
>>>>>  NameForm.is_valid():
>>>>>  NameForm.save()
>>>>>
>>>>> But on the second, version the "NameForm.save()" is missing. This is
>>>>> the line of code that save into you database. Maybe, should try putting it
>>>>> back...
>>>>>
>>>>> --
>>>>> 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/54d77f2f-58cf-455f-9b11-8857a5ffb32b%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/dja

Re: Working with forms

2020-04-05 Thread Ifeanyi Chielo
I tried using the form. save() but it gave the same error message as with
NameForm.save()
Dr. Chielo C. Ifeanyi
Chief Programmer,
Head Webometrics Section
ICT Unit, UNN
08032366433, 08154804230
ifeanyi.chi...@unn.edu.ng
http://www.unn.edu.ng/users/ifeanyichielo <http://www.unn.edu.ng>



On Sun, Apr 5, 2020 at 3:06 PM KONE GOMPOU LOUA ALASSANE <
gompou.k...@uvci.edu.ci> wrote:

> Use form. save() because you asigned NameForm to form like
>
> Le dim. 5 avr. 2020 à 14:04, Ifeanyi Chielo  a
> écrit :
>
>> I added the NameForm.Save() attribute and I had an AttributeError message
>> thus:
>> AttributeError at /namev/
>>
>> type object 'NameForm' has no attribute 'save'
>>
>> Request Method: POST
>> Request URL: http://localhost:8000/namev/
>> Django Version: 2.1.5
>> Exception Type: AttributeError
>> Exception Value:
>>
>> type object 'NameForm' has no attribute 'save'
>>
>> Exception Location: C:\Users\IFEANYI
>> CHIELO\divinecrownapp\pages\views.py in Namev_view, line 16
>> Python Executable: C:\Users\IFEANYI
>> CHIELO\AppData\Local\Programs\Python\Python37\python.exe
>> Python Version: 3.7.2
>> Python Path:
>>
>> ['C:\\Users\\IFEANYI CHIELO\\divinecrownapp',
>>  'C:\\Users\\IFEANYI '
>>  'CHIELO\\AppData\\Local\\Programs\\Python\\Python37\\python37.zip',
>>  'C:\\Users\\IFEANYI 
>> CHIELO\\AppData\\Local\\Programs\\Python\\Python37\\DLLs',
>>  'C:\\Users\\IFEANYI 
>> CHIELO\\AppData\\Local\\Programs\\Python\\Python37\\lib',
>>  'C:\\Users\\IFEANYI CHIELO\\AppData\\Local\\Programs\\Python\\Python37',
>>  'C:\\Users\\IFEANYI '
>>  'CHIELO\\AppData\\Local\\Programs\\Python\\Python37\\lib\\site-packages']
>>
>> Server time: Sun, 5 Apr 2020 13:59:01 +
>> Dr. Chielo C. Ifeanyi
>> Chief Programmer,
>> Head Webometrics Section
>> ICT Unit, UNN
>> 08032366433, 08154804230
>> ifeanyi.chi...@unn.edu.ng
>> http://www.unn.edu.ng/users/ifeanyichielo <http://www.unn.edu.ng>
>>
>>
>>
>> On Sun, Apr 5, 2020 at 2:45 PM Alejandro Avendano 
>> wrote:
>>
>>> Hi in the first version, you had:
>>>  NameForm.is_valid():
>>>  NameForm.save()
>>>
>>> But on the second, version the "NameForm.save()" is missing. This is the
>>> line of code that save into you database. Maybe, should try putting it
>>> back...
>>>
>>> --
>>> 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/54d77f2f-58cf-455f-9b11-8857a5ffb32b%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/CAOcS8H0wvTPnK1bmk6Q8XcKZ5R3BMxt_nq-EqkvFwUL1rB0n9Q%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAOcS8H0wvTPnK1bmk6Q8XcKZ5R3BMxt_nq-EqkvFwUL1rB0n9Q%40mail.gmail.com?utm_medium=email_source=footer>
>> .
>>
> --
> *La meilleure façon de prédire l’avenir est de le créer. *
>
>
> --
> 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/CANoHCsvTpDUzvjUksAq4EET011k1dRmTY4pUG_w8fFO26T9dng%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CANoHCsvTpDUzvjUksAq4EET011k1dRmTY4pUG_w8fFO26T9dng%40mail.gmail.com?utm_medium=email_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/CAOcS8H0FBxYptR5ffgL-cAw08PvWBfEnchYXxAjnsfXhiuRuwQ%40mail.gmail.com.


Re: Working with forms

2020-04-05 Thread Ifeanyi Chielo
I added the NameForm.Save() attribute and I had an AttributeError message
thus:
AttributeError at /namev/

type object 'NameForm' has no attribute 'save'

Request Method: POST
Request URL: http://localhost:8000/namev/
Django Version: 2.1.5
Exception Type: AttributeError
Exception Value:

type object 'NameForm' has no attribute 'save'

Exception Location: C:\Users\IFEANYI CHIELO\divinecrownapp\pages\views.py
in Namev_view, line 16
Python Executable: C:\Users\IFEANYI
CHIELO\AppData\Local\Programs\Python\Python37\python.exe
Python Version: 3.7.2
Python Path:

['C:\\Users\\IFEANYI CHIELO\\divinecrownapp',
 'C:\\Users\\IFEANYI '
 'CHIELO\\AppData\\Local\\Programs\\Python\\Python37\\python37.zip',
 'C:\\Users\\IFEANYI CHIELO\\AppData\\Local\\Programs\\Python\\Python37\\DLLs',
 'C:\\Users\\IFEANYI CHIELO\\AppData\\Local\\Programs\\Python\\Python37\\lib',
 'C:\\Users\\IFEANYI CHIELO\\AppData\\Local\\Programs\\Python\\Python37',
 'C:\\Users\\IFEANYI '
 'CHIELO\\AppData\\Local\\Programs\\Python\\Python37\\lib\\site-packages']

Server time: Sun, 5 Apr 2020 13:59:01 +
Dr. Chielo C. Ifeanyi
Chief Programmer,
Head Webometrics Section
ICT Unit, UNN
08032366433, 08154804230
ifeanyi.chi...@unn.edu.ng
http://www.unn.edu.ng/users/ifeanyichielo <http://www.unn.edu.ng>



On Sun, Apr 5, 2020 at 2:45 PM Alejandro Avendano 
wrote:

> Hi in the first version, you had:
>  NameForm.is_valid():
>  NameForm.save()
>
> But on the second, version the "NameForm.save()" is missing. This is the
> line of code that save into you database. Maybe, should try putting it
> back...
>
> --
> 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/54d77f2f-58cf-455f-9b11-8857a5ffb32b%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/CAOcS8H0wvTPnK1bmk6Q8XcKZ5R3BMxt_nq-EqkvFwUL1rB0n9Q%40mail.gmail.com.


Re: Working with forms

2020-04-04 Thread Ifeanyi Chielo
Thanks a lot, I believe I am close to the result. I did exactly what you
instructed and another error appeared thus:
ValueError at /namev/

The view pages.views.Namev_view didn't return an HttpResponse object.
It returned None instead.

Request Method: GET
Request URL: http://localhost:8000/namev/
Django Version: 2.1.5
Exception Type: ValueError
Exception Value:

The view pages.views.Namev_view didn't return an HttpResponse object.
It returned None instead.

Exception Location: C:\Users\IFEANYI
CHIELO\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\handlers\base.py
in _get_response, line 137
Python Executable: C:\Users\IFEANYI
CHIELO\AppData\Local\Programs\Python\Python37\python.exe
Python Version: 3.7.2
Python Path:

['C:\\Users\\IFEANYI CHIELO\\divinecrownapp',
 'C:\\Users\\IFEANYI '
 'CHIELO\\AppData\\Local\\Programs\\Python\\Python37\\python37.zip',
 'C:\\Users\\IFEANYI CHIELO\\AppData\\Local\\Programs\\Python\\Python37\\DLLs',
 'C:\\Users\\IFEANYI CHIELO\\AppData\\Local\\Programs\\Python\\Python37\\lib',
 'C:\\Users\\IFEANYI CHIELO\\AppData\\Local\\Programs\\Python\\Python37',
 'C:\\Users\\IFEANYI '
 'CHIELO\\AppData\\Local\\Programs\\Python\\Python37\\lib\\site-packages']

Server time: Sat, 4 Apr 2020 15:27:13 +Meanwhile the current code for
the view is shown below:
from django.http import HttpResponseRedirect
from django.shortcuts import render
from .models import Namerec
from .forms import NameForm
from django.views.generic import TemplateView

def HomePageView (request, *args, **kwargs):
 return render(request,"home.html", {})
def Namev_view (request):
form = NameForm ()
# if this is a POST request we need to process the form data
if request.method == 'POST':
# create a form instance and populate it with data from the request:
form = NameForm (request.POST)
# check whether it's valid:
if NameForm.is_valid():
NameForm.save()
context = {
'form': form
}
return render(request, 'namev.html', {'form':form})

Dr. Chielo C. Ifeanyi
Chief Programmer,
Head Webometrics Section
ICT Unit, UNN
08032366433, 08154804230
ifeanyi.chi...@unn.edu.ng
http://www.unn.edu.ng/users/ifeanyichielo <http://www.unn.edu.ng>



On Sat, Apr 4, 2020 at 3:21 PM Luqman Shofuleji 
wrote:

> Okay, now the new error is that is not seeing that 'form' for the get
> request,
> you need to also add  form = NameForm () before the if statement "if
> request.method == 'POST' " to handle the page get request.
>
>
>
> On Sat, Apr 4, 2020, 12:33 PM Ifeanyi Chielo 
> wrote:
>
>> Thanks a lot,
>> I did as you said and I encountered the error message below:
>> UnboundLocalError at /namev/
>>
>> local variable 'form' referenced before assignment
>>
>> Request Method: GET
>> Request URL: http://localhost:8000/namev/
>> Django Version: 2.1.5
>> Exception Type: UnboundLocalError
>> Exception Value:
>>
>> local variable 'form' referenced before assignment
>>
>> Exception Location: C:\Users\IFEANYI
>> CHIELO\divinecrownapp\pages\views.py in Namev_view, line 42
>> Python Executable: C:\Users\IFEANYI
>> CHIELO\AppData\Local\Programs\Python\Python37\python.exe
>> Python Version: 3.7.2
>> Python Path:
>>
>> ['C:\\Users\\IFEANYI CHIELO\\divinecrownapp',
>>  'C:\\Users\\IFEANYI '
>>  'CHIELO\\AppData\\Local\\Programs\\Python\\Python37\\python37.zip',
>>  'C:\\Users\\IFEANYI 
>> CHIELO\\AppData\\Local\\Programs\\Python\\Python37\\DLLs',
>>  'C:\\Users\\IFEANYI 
>> CHIELO\\AppData\\Local\\Programs\\Python\\Python37\\lib',
>>  'C:\\Users\\IFEANYI CHIELO\\AppData\\Local\\Programs\\Python\\Python37',
>>  'C:\\Users\\IFEANYI '
>>  'CHIELO\\AppData\\Local\\Programs\\Python\\Python37\\lib\\site-packages']
>>
>> Server time: Sat, 4 Apr 2020 11:27:07 +
>> Dr. Chielo C. Ifeanyi
>> Chief Programmer,
>> Head Webometrics Section
>> ICT Unit, UNN
>> 08032366433, 08154804230
>> ifeanyi.chi...@unn.edu.ng
>> http://www.unn.edu.ng/users/ifeanyichielo <http://www.unn.edu.ng>
>>
>>
>>
>> On Sat, Apr 4, 2020 at 10:09 AM Luqman Shofuleji 
>> wrote:
>>
>>> In def Namev_view under views.py, include form in the return parameter
>>> and see if that resolves the issue
>>>
>>> return render(request, 'namev.html', {'form':form})
>>>
>>>
>>>
>>> On Sat, Apr 4, 2020, 1:35 AM Ifeanyi Chielo 
>>> wrote:
>>>
>>>> Hello,I developed a form with a single field, but this form displays
>>>> only the submit button at the browser as shown in the image below. Please
>>>> how can I correct

Re: Working with forms

2020-04-04 Thread Ifeanyi Chielo
Screen shorts of codes available above

Dr. Chielo C. Ifeanyi
Chief Programmer,
Head Webometrics Section
ICT Unit, UNN
08032366433, 08154804230
ifeanyi.chi...@unn.edu.ng
http://www.unn.edu.ng/users/ifeanyichielo <http://www.unn.edu.ng>



On Sat, Apr 4, 2020 at 12:35 PM KONE GOMPOU LOUA ALASSANE <
gompou.k...@uvci.edu.ci> wrote:

> Send screen short
>
> Le sam. 4 avr. 2020 à 11:33, Ifeanyi Chielo  a
> écrit :
>
>> Thanks a lot,
>> I did as you said and I encountered the error message below:
>> UnboundLocalError at /namev/
>>
>> local variable 'form' referenced before assignment
>>
>> Request Method: GET
>> Request URL: http://localhost:8000/namev/
>> Django Version: 2.1.5
>> Exception Type: UnboundLocalError
>> Exception Value:
>>
>> local variable 'form' referenced before assignment
>>
>> Exception Location: C:\Users\IFEANYI
>> CHIELO\divinecrownapp\pages\views.py in Namev_view, line 42
>> Python Executable: C:\Users\IFEANYI
>> CHIELO\AppData\Local\Programs\Python\Python37\python.exe
>> Python Version: 3.7.2
>> Python Path:
>>
>> ['C:\\Users\\IFEANYI CHIELO\\divinecrownapp',
>>  'C:\\Users\\IFEANYI '
>>  'CHIELO\\AppData\\Local\\Programs\\Python\\Python37\\python37.zip',
>>  'C:\\Users\\IFEANYI 
>> CHIELO\\AppData\\Local\\Programs\\Python\\Python37\\DLLs',
>>  'C:\\Users\\IFEANYI 
>> CHIELO\\AppData\\Local\\Programs\\Python\\Python37\\lib',
>>  'C:\\Users\\IFEANYI CHIELO\\AppData\\Local\\Programs\\Python\\Python37',
>>  'C:\\Users\\IFEANYI '
>>  'CHIELO\\AppData\\Local\\Programs\\Python\\Python37\\lib\\site-packages']
>>
>> Server time: Sat, 4 Apr 2020 11:27:07 +
>> Dr. Chielo C. Ifeanyi
>> Chief Programmer,
>> Head Webometrics Section
>> ICT Unit, UNN
>> 08032366433, 08154804230
>> ifeanyi.chi...@unn.edu.ng
>> http://www.unn.edu.ng/users/ifeanyichielo <http://www.unn.edu.ng>
>>
>>
>>
>> On Sat, Apr 4, 2020 at 10:09 AM Luqman Shofuleji 
>> wrote:
>>
>>> In def Namev_view under views.py, include form in the return parameter
>>> and see if that resolves the issue
>>>
>>> return render(request, 'namev.html', {'form':form})
>>>
>>>
>>>
>>> On Sat, Apr 4, 2020, 1:35 AM Ifeanyi Chielo 
>>> wrote:
>>>
>>>> Hello,I developed a form with a single field, but this form displays
>>>> only the submit button at the browser as shown in the image below. Please
>>>> how can I correct this and also  save the field to the MySQL table.  My
>>>> code is also shown below
>>>>
>>>> [image: django form.png]
>>>>
>>>> View.py
>>>>
>>>> from django.http import HttpResponseRedirect
>>>>
>>>> from django.shortcuts import render
>>>>
>>>> from .models import Namerec
>>>>
>>>> from .forms import NameForm
>>>>
>>>> from django.views.generic import TemplateView
>>>>
>>>>
>>>>
>>>> def HomePageView (request, *args, **kwargs):
>>>>
>>>>  return render(request,"home.html", {})
>>>>
>>>> def Namev_view (request):
>>>>
>>>> if request.method == 'POST':
>>>>
>>>> form = NameForm (request.POST)
>>>>
>>>> if NameForm.is_valid():
>>>>
>>>> NameForm.save()
>>>>
>>>> context = {
>>>>
>>>> 'form': form
>>>>
>>>> }
>>>>
>>>> return render(request, 'namev.html', {})
>>>>
>>>> form.py
>>>>
>>>> from .models import Namerec
>>>>
>>>> from django import forms
>>>>
>>>> class NameForm(forms.Form):
>>>>
>>>> your_name = forms.CharField(label='Your name', max_length=100)
>>>>
>>>> template (namev.htlm)
>>>>
>>>> 
>>>>
>>>> {% csrf_token %}
>>>>
>>>> {{ form  }}
>>>>
>>>> 
>>>>
>>>> 
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> Model.py
>>>>
>>>> from django.db import models
>>>>
>>>> class Namerec(models.Model):
>>>>
>>>> your_name = models.Ch

Re: Working with forms

2020-04-04 Thread Ifeanyi Chielo
Thanks a lot,
I did as you said and I encountered the error message below:
UnboundLocalError at /namev/

local variable 'form' referenced before assignment

Request Method: GET
Request URL: http://localhost:8000/namev/
Django Version: 2.1.5
Exception Type: UnboundLocalError
Exception Value:

local variable 'form' referenced before assignment

Exception Location: C:\Users\IFEANYI CHIELO\divinecrownapp\pages\views.py
in Namev_view, line 42
Python Executable: C:\Users\IFEANYI
CHIELO\AppData\Local\Programs\Python\Python37\python.exe
Python Version: 3.7.2
Python Path:

['C:\\Users\\IFEANYI CHIELO\\divinecrownapp',
 'C:\\Users\\IFEANYI '
 'CHIELO\\AppData\\Local\\Programs\\Python\\Python37\\python37.zip',
 'C:\\Users\\IFEANYI CHIELO\\AppData\\Local\\Programs\\Python\\Python37\\DLLs',
 'C:\\Users\\IFEANYI CHIELO\\AppData\\Local\\Programs\\Python\\Python37\\lib',
 'C:\\Users\\IFEANYI CHIELO\\AppData\\Local\\Programs\\Python\\Python37',
 'C:\\Users\\IFEANYI '
 'CHIELO\\AppData\\Local\\Programs\\Python\\Python37\\lib\\site-packages']

Server time: Sat, 4 Apr 2020 11:27:07 +
Dr. Chielo C. Ifeanyi
Chief Programmer,
Head Webometrics Section
ICT Unit, UNN
08032366433, 08154804230
ifeanyi.chi...@unn.edu.ng
http://www.unn.edu.ng/users/ifeanyichielo <http://www.unn.edu.ng>



On Sat, Apr 4, 2020 at 10:09 AM Luqman Shofuleji 
wrote:

> In def Namev_view under views.py, include form in the return parameter
> and see if that resolves the issue
>
> return render(request, 'namev.html', {'form':form})
>
>
>
> On Sat, Apr 4, 2020, 1:35 AM Ifeanyi Chielo 
> wrote:
>
>> Hello,I developed a form with a single field, but this form displays only
>> the submit button at the browser as shown in the image below. Please how
>> can I correct this and also  save the field to the MySQL table.  My code is
>> also shown below
>>
>> [image: django form.png]
>>
>> View.py
>>
>> from django.http import HttpResponseRedirect
>>
>> from django.shortcuts import render
>>
>> from .models import Namerec
>>
>> from .forms import NameForm
>>
>> from django.views.generic import TemplateView
>>
>>
>>
>> def HomePageView (request, *args, **kwargs):
>>
>>  return render(request,"home.html", {})
>>
>> def Namev_view (request):
>>
>> if request.method == 'POST':
>>
>> form = NameForm (request.POST)
>>
>> if NameForm.is_valid():
>>
>> NameForm.save()
>>
>> context = {
>>
>> 'form': form
>>
>> }
>>
>> return render(request, 'namev.html', {})
>>
>> form.py
>>
>> from .models import Namerec
>>
>> from django import forms
>>
>> class NameForm(forms.Form):
>>
>> your_name = forms.CharField(label='Your name', max_length=100)
>>
>> template (namev.htlm)
>>
>> 
>>
>> {% csrf_token %}
>>
>> {{ form  }}
>>
>> 
>>
>> 
>>
>>
>>
>>
>>
>> Model.py
>>
>> from django.db import models
>>
>> class Namerec(models.Model):
>>
>> your_name = models.CharField(max_length=30)
>>
>>
>>
>> --
>> 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/f50577dd-d5c0-4478-8993-7bab533f24f9%40googlegroups.com
>> <https://groups.google.com/d/msgid/django-users/f50577dd-d5c0-4478-8993-7bab533f24f9%40googlegroups.com?utm_medium=email_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/CAHyB84rUTDyiba%2B%2Bvk%3DJFuRN7CPBPTpso2JvyBc28Q4gG-faYg%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAHyB84rUTDyiba%2B%2Bvk%3DJFuRN7CPBPTpso2JvyBc28Q4gG-faYg%40mail.gmail.com?utm_medium=email_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/CAOcS8H1YiVcABEXBEa5-qEu4V4NBeGfY3PkFa%3DYCf9OEdUAO-Q%40mail.gmail.com.


Re: Working with forms

2020-04-04 Thread Ifeanyi Chielo
Yes the app name is already included in the settings.py

Dr. Chielo C. Ifeanyi
Chief Programmer,
Head Webometrics Section
ICT Unit, UNN
08032366433, 08154804230
ifeanyi.chi...@unn.edu.ng
http://www.unn.edu.ng/users/ifeanyichielo <http://www.unn.edu.ng>



On Sat, Apr 4, 2020 at 6:35 AM Bruckner de Villiers <
bruckner.devilli...@gmail.com> wrote:

> Please share code for home.html & urls.py.  Also have you included the app
> name in the settings.py?
>
> Thanks,
>
>
>
> Bruckner de Villiers
>
> 083 625 1086
>
>
>
> *From: * on behalf of Ifeanyi Chielo <
> ifeanyi.chi...@unn.edu.ng>
> *Reply to: *
> *Date: *Saturday, 04 April 2020 at 02:51
> *To: *Django users 
> *Subject: *Re: Working with forms
>
>
>
> Thanks Victor,
>
> I did it and it does not make any cnange
>
>
> On Saturday, April 4, 2020 at 1:41:19 AM UTC+1, victor awakan wrote:
>
> In the form template tag, shouldn’t it be {{ form.as_p}} tag?
>
>
>
> On Sat 4. Apr 2020 at 3.35, Ifeanyi Chielo  wrote:
>
> Hello,I developed a form with a single field, but this form displays only
> the submit button at the browser as shown in the image below. Please how
> can I correct this and also  save the field to the MySQL table.  My code is
> also shown below
>
>
>
> View.py
>
> from django.http import HttpResponseRedirect
>
> from django.shortcuts import render
>
> from .models import Namerec
>
> from .forms import NameForm
>
> from django.views.generic import TemplateView
>
>
>
> def HomePageView (request, *args, **kwargs):
>
>  return render(request,"home.html", {})
>
> def Namev_view (request):
>
> if request.method == 'POST':
>
> form = NameForm (request.POST)
>
> if NameForm.is_valid():
>
> NameForm.save()
>
> context = {
>
> 'form': form
>
> }
>
> return render(request, 'namev.html', {})
>
> form.py
>
> from .models import Namerec
>
> from django import forms
>
> class NameForm(forms.Form):
>
> your_name = forms.CharField(label='Your name', max_length=100)
>
> template (namev.htlm)
>
> 
>
> {% csrf_token %}
>
> {{ form  }}
>
> 
>
> 
>
>
>
>
>
> Model.py
>
> from django.db import models
>
> class Namerec(models.Model):
>
> your_name = models.CharField(max_length=30)
>
>
>
>
>
> --
> 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/f50577dd-d5c0-4478-8993-7bab533f24f9%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/f50577dd-d5c0-4478-8993-7bab533f24f9%40googlegroups.com?utm_medium=email_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/9825aec7-7e87-4d4a-80f9-634cb9e4dd59%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/9825aec7-7e87-4d4a-80f9-634cb9e4dd59%40googlegroups.com?utm_medium=email_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/E47A5C26-9855-4ED7-86AD-3F427A2E88B7%40gmail.com
> <https://groups.google.com/d/msgid/django-users/E47A5C26-9855-4ED7-86AD-3F427A2E88B7%40gmail.com?utm_medium=email_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/CAOcS8H1Zj33iOTxb4KQkJsVqcTZo68W0wtzjJQ4we9nz5axx9A%40mail.gmail.com.


Re: Working with forms

2020-04-04 Thread Ifeanyi Chielo
Hello,
Here are the codes:

View

from django.http import HttpResponseRedirect

from django.shortcuts import render

from .models import Namerec

from .forms import NameForm

from django.views.generic import TemplateView



def HomePageView (request, *args, **kwargs):

 return render(request,"home.html", {})



project url

from django.contrib import admin

from django.urls import path, include



urlpatterns = [

path('admin/', admin.site.urls),

path('', include('pages.urls')),

]





App url

urlpatterns = [

path('', HomePageView, name = 'home'),

path('namev/', Namev_view),

#path('', HomePageView),

#path('namev/', Nameview_view),



]

 Note, I have not written any code at home.html template and it is
rendering well

Dr. Chielo C. Ifeanyi
Chief Programmer,
Head Webometrics Section
ICT Unit, UNN
08032366433, 08154804230
ifeanyi.chi...@unn.edu.ng
http://www.unn.edu.ng/users/ifeanyichielo <http://www.unn.edu.ng>



On Sat, Apr 4, 2020 at 6:35 AM Bruckner de Villiers <
bruckner.devilli...@gmail.com> wrote:

> Please share code for home.html & urls.py.  Also have you included the app
> name in the settings.py?
>
> Thanks,
>
>
>
> Bruckner de Villiers
>
> 083 625 1086
>
>
>
> *From: * on behalf of Ifeanyi Chielo <
> ifeanyi.chi...@unn.edu.ng>
> *Reply to: *
> *Date: *Saturday, 04 April 2020 at 02:51
> *To: *Django users 
> *Subject: *Re: Working with forms
>
>
>
> Thanks Victor,
>
> I did it and it does not make any cnange
>
>
> On Saturday, April 4, 2020 at 1:41:19 AM UTC+1, victor awakan wrote:
>
> In the form template tag, shouldn’t it be {{ form.as_p}} tag?
>
>
>
> On Sat 4. Apr 2020 at 3.35, Ifeanyi Chielo  wrote:
>
> Hello,I developed a form with a single field, but this form displays only
> the submit button at the browser as shown in the image below. Please how
> can I correct this and also  save the field to the MySQL table.  My code is
> also shown below
>
>
>
> View.py
>
> from django.http import HttpResponseRedirect
>
> from django.shortcuts import render
>
> from .models import Namerec
>
> from .forms import NameForm
>
> from django.views.generic import TemplateView
>
>
>
> def HomePageView (request, *args, **kwargs):
>
>  return render(request,"home.html", {})
>
> def Namev_view (request):
>
> if request.method == 'POST':
>
> form = NameForm (request.POST)
>
> if NameForm.is_valid():
>
> NameForm.save()
>
> context = {
>
> 'form': form
>
> }
>
> return render(request, 'namev.html', {})
>
> form.py
>
> from .models import Namerec
>
> from django import forms
>
> class NameForm(forms.Form):
>
> your_name = forms.CharField(label='Your name', max_length=100)
>
> template (namev.htlm)
>
> 
>
> {% csrf_token %}
>
> {{ form  }}
>
> 
>
> 
>
>
>
>
>
> Model.py
>
> from django.db import models
>
> class Namerec(models.Model):
>
> your_name = models.CharField(max_length=30)
>
>
>
>
>
> --
> 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/f50577dd-d5c0-4478-8993-7bab533f24f9%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/f50577dd-d5c0-4478-8993-7bab533f24f9%40googlegroups.com?utm_medium=email_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/9825aec7-7e87-4d4a-80f9-634cb9e4dd59%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/9825aec7-7e87-4d4a-80f9-634cb9e4dd59%40googlegroups.com?utm_medium=email_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/E47A5C26-9855-4ED7-86AD-3F427A2E88B7%40gmail.com
> <https://groups.google.com/d/msgid/django-users/E47A5C26-9855-4ED7-86AD-3F427A2E88B7%40gmail.com?utm_medium=email_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/CAOcS8H3QEdWtT%3DRn4P%2B9LFA%3DjTPQHgCi3V_BYwbOsc6DHcD%2BRQ%40mail.gmail.com.


Re: Working with forms

2020-04-03 Thread Ifeanyi Chielo
Thanks Victor, 
I did it and it does not make any cnange

On Saturday, April 4, 2020 at 1:41:19 AM UTC+1, victor awakan wrote:
>
> In the form template tag, shouldn’t it be {{ form.as_p}} tag?
>
> On Sat 4. Apr 2020 at 3.35, Ifeanyi Chielo  > wrote:
>
>> Hello,I developed a form with a single field, but this form displays only 
>> the submit button at the browser as shown in the image below. Please how 
>> can I correct this and also  save the field to the MySQL table.  My code is 
>> also shown below
>>
>> [image: django form.png]
>>
>> View.py 
>>
>> from django.http import HttpResponseRedirect
>>
>> from django.shortcuts import render
>>
>> from .models import Namerec
>>
>> from .forms import NameForm
>>
>> from django.views.generic import TemplateView
>>
>>  
>>
>> def HomePageView (request, *args, **kwargs):
>>
>>  return render(request,"home.html", {})
>>
>> def Namev_view (request):
>>
>> if request.method == 'POST':
>>
>> form = NameForm (request.POST)
>>
>> if NameForm.is_valid():
>>
>> NameForm.save()
>>
>> context = {
>>
>> 'form': form
>>
>> }
>>
>> return render(request, 'namev.html', {})
>>
>> form.py
>>
>> from .models import Namerec
>>
>> from django import forms
>>
>> class NameForm(forms.Form):
>>
>> your_name = forms.CharField(label='Your name', max_length=100)
>>
>> template (namev.htlm)
>>
>> 
>>
>> {% csrf_token %}
>>
>> {{ form  }}
>>
>> 
>>
>> 
>>
>>  
>>
>>  
>>
>> Model.py 
>>
>> from django.db import models
>>
>> class Namerec(models.Model):
>>
>> your_name = models.CharField(max_length=30)
>>
>>
>>
>> -- 
>> 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/f50577dd-d5c0-4478-8993-7bab533f24f9%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/f50577dd-d5c0-4478-8993-7bab533f24f9%40googlegroups.com?utm_medium=email_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/9825aec7-7e87-4d4a-80f9-634cb9e4dd59%40googlegroups.com.


Working with forms

2020-04-03 Thread Ifeanyi Chielo
Hello,I developed a form with a single field, but this form displays only 
the submit button at the browser as shown in the image below. Please how 
can I correct this and also  save the field to the MySQL table.  My code is 
also shown below

[image: django form.png]

View.py 

from django.http import HttpResponseRedirect

from django.shortcuts import render

from .models import Namerec

from .forms import NameForm

from django.views.generic import TemplateView

 

def HomePageView (request, *args, **kwargs):

 return render(request,"home.html", {})

def Namev_view (request):

if request.method == 'POST':

form = NameForm (request.POST)

if NameForm.is_valid():

NameForm.save()

context = {

'form': form

}

return render(request, 'namev.html', {})

form.py

from .models import Namerec

from django import forms

class NameForm(forms.Form):

your_name = forms.CharField(label='Your name', max_length=100)

template (namev.htlm)



{% csrf_token %}

{{ form  }}





 

 

Model.py 

from django.db import models

class Namerec(models.Model):

your_name = models.CharField(max_length=30)

   

-- 
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/f50577dd-d5c0-4478-8993-7bab533f24f9%40googlegroups.com.


Inability to Connect django with MySQL database

2020-03-20 Thread Ifeanyi Chielo
Hello, 
I am new to Python django, I have been making efforts to connect a django 
application to mysql without success. Bellow is the information that I got
PS C:\Users\IFEANYI CHIELO\divine> python manage.py migrate
Traceback (most recent call last):
  File "C:\Users\IFEANYI 
CHIELO\AppData\Local\Programs\Python\Python37\lib\site-packages\django\db\backends\base\base.py",
 
line 216, in ensure_connection
self.connect()
  File "C:\Users\IFEANYI 
CHIELO\AppData\Local\Programs\Python\Python37\lib\site-packages\django\db\backends\base\base.py",
 
line 194, in connect
self.connection = self.get_new_connection(conn_params)
  File "C:\Users\IFEANYI 
CHIELO\AppData\Local\Programs\Python\Python37\lib\site-packages\django\db\backends\mysql\base.py",
 
line 227, in get_new_connection
return Database.connect(**conn_params)
  File "C:\Users\IFEANYI 
CHIELO\AppData\Local\Programs\Python\Python37\lib\site-packages\MySQLdb\__init__.py",
 
line 84, in Connect
return Connection(*args, **kwargs)
  File "C:\Users\IFEANYI 
CHIELO\AppData\Local\Programs\Python\Python37\lib\site-packages\MySQLdb\connections.py",
 
line 179, in __init__
super(Connection, self).__init__(*args, **kwargs2)
MySQLdb._exceptions.OperationalError: (1045, "Access denied for user 
'admin'@'localhost' (using password: NO)")

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "manage.py", line 15, in 
execute_from_command_line(sys.argv)
  File "C:\Users\IFEANYI 
CHIELO\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\management\__init__.py",
 
line 381, in execute_from_command_line
utility.execute()
  File "C:\Users\IFEANYI 
CHIELO\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\management\__init__.py",
 
line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
  File "C:\Users\IFEANYI 
CHIELO\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\management\base.py",
 
line 316, in run_from_argv
self.execute(*args, **cmd_options)
  File "C:\Users\IFEANYI 
CHIELO\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\management\base.py",
 
line 350, in execute
self.check()
  File "C:\Users\IFEANYI 
CHIELO\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\management\base.py",
 
line 379, in check
include_deployment_checks=include_deployment_checks,
  File "C:\Users\IFEANYI 
CHIELO\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\management\commands\migrate.py",
 
line 59, in _run_checks
issues = run_checks(tags=[Tags.database])
  File "C:\Users\IFEANYI 
CHIELO\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\checks\registry.py",
 
line 71, in run_checks
new_errors = check(app_configs=app_configs)
  File "C:\Users\IFEANYI 
CHIELO\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\checks\database.py",
 
line 10, in check_database_backends
issues.extend(conn.validation.check(**kwargs))
  File "C:\Users\IFEANYI 
CHIELO\AppData\Local\Programs\Python\Python37\lib\site-packages\django\db\backends\mysql\validation.py",
 
line 9, in check
issues.extend(self._check_sql_mode(**kwargs))
  File "C:\Users\IFEANYI 
CHIELO\AppData\Local\Programs\Python\Python37\lib\site-packages\django\db\backends\mysql\validation.py",
 
line 13, in _check_sql_mode
with self.connection.cursor() as cursor:
  File "C:\Users\IFEANYI 
CHIELO\AppData\Local\Programs\Python\Python37\lib\site-packages\django\db\backends\base\base.py",
 
line 255, in cursor
return self._cursor()
  File "C:\Users\IFEANYI 
CHIELO\AppData\Local\Programs\Python\Python37\lib\site-packages\django\db\backends\base\base.py",
 
line 232, in _cursor
self.ensure_connection()
  File "C:\Users\IFEANYI 
CHIELO\AppData\Local\Programs\Python\Python37\lib\site-packages\django\db\backends\base\base.py",
 
line 216, in ensure_connection
self.connect()
  File "C:\Users\IFEANYI 
CHIELO\AppData\Local\Programs\Python\Python37\lib\site-packages\django\db\utils.py",
 
line 89, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
  File "C:\Users\IFEANYI 
CHIELO\AppData\Local\Programs\Python\Python37\lib\site-packages\django\db\backends\base\base.py",
 
line 216, in ensure_connection
self.connect()
  File "C:\Users\IFEANYI 
CHIELO\AppData\Local\Programs\Python\Python37\lib\site-packages\django\db\backends\base\base.py",
 
line 194, in connect
self.connection = self.get_new_connection(conn_params)
  File "C:\Users\IFEANYI 
CHIELO\AppData\Local\Programs\Python\Python37\lib\site-packages\django\db\backends\mysql\base.py",
 
line 227, in get_new_connection
return Database