Re: A learner following a Mosh Tutorial on Django and having a problem saving a product to SQLite

2020-05-04 Thread i...@serenityscotland.co.uk/webmail
Hi Folks,

Here is models.py:

from django.db import models

class Product(models.Model):
name = models.CharField(max_length=255)
price = models.FloatField()
stock = models.IntegerField()
image_url = models.CharField(max_length=2083)


class Offer(models.Model):
code = models.CharField(max_length=10)
description = models.CharField(max_length=255)
discount = models.FloatField()


Thank you for any help!


Iain


On Sun, 3 May 2020 at 23:13, Adedotun Richard  wrote:

> Can you paste your model.py class for products?
> There is probability that you are getting the write-up wrong.
>
>
> On Sat, May 2, 2020, 3:43 PM Iain Stewart 
> wrote:
>
>> Hi Folks,
>>
>> I am a learner and am enjoying learning Django so far (about a month
>> in). I am doing the Mosh Python Tutorial for Begnniners on You Tube and in
>> trying to save my first product on the Django admin/ products page and got
>> the following error. I suspect the problem is between Django and SQLite.
>> Any possible solution would be appreciated. Thanks!
>> Request Method: POST Request URL: 
>> http://127.0.0.1:8000/admin/products/product/add/
>>
>> 
>>  Django
>> Version: 2.1 Python Version: 3.7.7 Installed Applications: 
>> ['django.contrib.admin',
>> 'django.contrib.auth', 'django.contrib.contenttypes', 
>> 'django.contrib.sessions',
>> 'django.contrib.messages', 'django.contrib.staticfiles', 
>> 'products.apps.ProductsConfig']
>> Installed Middleware: ['django.middleware.security.SecurityMiddleware', 
>> 'django.contrib.sessions.middleware.SessionMiddleware',
>> 'django.middleware.common.CommonMiddleware', 
>> 'django.middleware.csrf.CsrfViewMiddleware',
>> 'django.contrib.auth.middleware.AuthenticationMiddleware', 
>> 'django.contrib.messages.middleware.MessageMiddleware',
>> 'django.middleware.clickjacking.XFrameOptionsMiddleware'] Traceback: File
>> "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\db\backends\
>> utils.py
>> "
>> in _execute 85. return self.cursor.execute(sql, params) File
>> "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\db\backends\sqlite3\
>> base.py
>> "
>> in execute 296. return Database.Cursor.execute(self, query, params) The
>> above exception (no such table: main.auth_user__old) was the direct cause
>> of the following exception: File
>> "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\core\handlers\
>> exception.py
>> "
>> in inner 34. response = get_response(request) File
>> "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\core\handlers\
>> base.py
>> "
>> in _get_response 126. response = self.process_exception_by_middleware(e,
>> request) File
>> "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\core\handlers\
>> base.py
>> "
>> in _get_response 124. response = wrapped_callback(request,
>> *callback_args, **callback_kwargs) File
>> "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\contrib\admin\
>> options.py
>> "
>> in wrapper 607. return self.admin_site.admin_view(view)(*args, **kwargs) File
>> "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\utils\
>> decorators.py
>> "
>> in _wrapped_view 142. response = view_func(request, *args, **kwargs) File
>> "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\views\decorators\
>> cache.py
>> "
>> in _wrapped_view

Re: Possible server attacks

2020-05-04 Thread Miracle
Okay,

I will do all those.

Thank you so much.

I appreciate.

On Mon, 4 May 2020, 1:26 am Motaz Hejaze,  wrote:

> check the log file , what are the acts that invokes the call to those
> links 
> example , logging in ? upload an image ? any act
>
> also try to check if there is a malicious script installed on your server
> ,
>
> take a peace from the text above and search for it ..
>
> Example:
>
> grep -lR "/sqlitemanager/main.php" /home
>
> replace /home with the location of your files ..and replace the string by
> anything from the error message above
>
> On Mon, May 4, 2020 at 1:24 AM Ahmed Ishtiaque 
> wrote:
>
>> Observe how your server responds to these requests. Sometimes these
>> requests are sent by attackers hoping that your server might respond with
>> sensitive data that it shouldn't be sending. Generally, ensuring that
>> invalid requests end up with your server sending error responses and not
>> actual sensitive data that your database has is all you need to do.
>>
>> Hope this helps.
>>
>> On Sun, May 3, 2020 at 6:51 PM Miracle  wrote:
>>
>>> I do not know of any script like that.
>>> Atleast, I didn't write any.
>>>
>>> A get these calls on the following paths:
>>>
>>> /sqlite/main.php,
>>> /robots.txt,
>>> /,
>>> /owa/auth/logon.aspx,
>>> /cgi-bin/config.exp,
>>> /HNAP1/,
>>> /hudson/script,
>>> /script,
>>> /sqlitemanager/main.php,
>>>  /SQLiteManager/main.php,
>>> /SQLite/main.php,
>>> /main.php,
>>> /test/sqlite/SQLiteManager-1.2.0/SQLiteManager-1.2.0/main.php,
>>> /favicon.co
>>>
>>>
>>> Please, what could be the problem?
>>>
>>>
>>>
>>>
>>>
>>> On Sun, 3 May 2020, 11:03 pm Motaz Hejaze,  wrote:
>>>
 I think you have a script somewhere that calls this ip and main.php on
 that server ..

 Do you add any third party addons both on frontend and backend ??


 On Sun, 3 May 2020, 11:31 pm Miracle,  wrote:

> I think the possible attacker thinks I am using PHP
>
> On Sun, 3 May 2020, 10:29 pm Miracle,  wrote:
>
>> I don't know honestly.
>>
>> I got those error messages because I included my email and username
>> in settings.py like this
>>
>> ADMINS = ['username', 'collinsale...@gmail.com']
>>
>> On Sun, 3 May 2020, 10:24 pm Motaz Hejaze, 
>> wrote:
>>
>>> What is the script main.php ???
>>>
>>> On Sun, 3 May 2020, 10:43 pm Miracle, 
>>> wrote:
>>>
 Hello django developers,

 I might be experiencing a possible attack on my web server,  but I
 am not sure yet.
 Below is the email I got from my django.
 I've gotten over 50 similar emails over the past 3 days.

 Please, help me with this.


 Invalid HTTP_HOST header: '35.192.28.182'. You may need to add
 '35.192.28.182' to ALLOWED_HOSTS.

 Report at /SQlite/main.php

 Invalid HTTP_HOST header: '35.192.28.182'. You may need to add
 '35.192.28.182' to ALLOWED_HOSTS.

 Request Method: GET
 Request URL: https://35.192.28.182/SQlite/main.php

 Django Version: 2.2.8
 Python Executable: /home/hello/wsp/env/bin/python3
 Python Version: 3.6.9
 Python Path: ['/home/hello/wsp', '/home/hello/wsp/env/bin',
 '/usr/lib/python36.zip', '/usr/lib/python3.6',
 '/usr/lib/python3.6/lib-dynload',
 '/home/hello/wsp/env/lib/python3.6/site-packages']
 Server time: Sun, 3 May 2020 19:22:55 +
 Show quoted text
 HTTP_ACCEPT =
 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9'
 HTTP_ACCEPT_ENCODING = 'gzip, deflate, br'
 HTTP_ACCEPT_LANGUAGE = 'en-GB,en-US;q=0.9,en;q=0.8,ig;q=0.7'
 HTTP_CONNECTION = 'close'
 HTTP_COOKIE =
 'csrftoken=mX6nNccvMIycyGeE4tF0hciqwfsccdaK8X8ZDt8YgimJeQYTjQFjxfB4YGNCZ9Ik;
 sessionid=mbmg0dvoz2tebman7ereia9eue59wto7'
 HTTP_HOST = '35.192.28.182'
 HTTP_SAVE_DATA = 'on'

 HTTP_SEC_FETCH_DEST = 'document'
 HTTP_SEC_FETCH_MODE = 'navigate'
 HTTP_SEC_FETCH_SITE = 'none'
 HTTP_UPGRADE_INSECURE_REQUESTS = '1'
 HTTP_USER_AGENT = 'Mozilla/5.0 (Linux; Android 9; SM-A307FN)
 AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.117 Mobile
 Safari/537.36'
 HTTP_X_FORWARDED_FOR = '197.211.61.210'
 HTTP_X_FORWARDED_PROTO = 'https'
 HTTP_X_REAL_IP = '197.211.61.210'
 PATH_INFO = '/SQlite/main.php'
 QUERY_STRING = ''
 RAW_URI = '/SQlite/main.php'
 REMOTE_ADDR = ''
 REQUEST_METHOD = 'GET'
 SCRIPT_NAME = ''
 SERVER_NAME = '35.192.28.182'
 SERVER_PORT = '443'
 SERVER_PROTOCOL = 'HTTP/1.0'
 SERVER_SOFTWARE = 'gunicorn/20.0.4'
 gunicorn.socket = >>> family=AddressFamily.AF_UNIX, type

Django Package Website is not opening

2020-05-04 Thread Hamza Mirchi
Hi Everyone,

Please Fix This issue

This website is not opening
https://djangopackages.org/
I need to check packages for my Django app but it's not opening please fix 
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/5b84cacf-b1ef-43b2-aaf3-e4320e33ceff%40googlegroups.com.


Re: Django Package Website is not opening

2020-05-04 Thread Mike Dewhirst

On 4/05/2020 6:14 pm, Hamza Mirchi wrote:

Hi Everyone,

Please Fix This issue

This website is not opening
https://djangopackages.org/
I need to check packages for my Django app but it's not opening please 
fix that


Works for me


--
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/5b84cacf-b1ef-43b2-aaf3-e4320e33ceff%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/6f80c472-093b-0520-df04-e5f73a97918c%40dewhirst.com.au.


Re: Django Package Website is not opening

2020-05-04 Thread Hamza Mirchi
If I use VPN it works but without VPN it's not working

On Monday, May 4, 2020 at 4:22:37 AM UTC-4, Mike Dewhirst wrote:
>
> On 4/05/2020 6:14 pm, Hamza Mirchi wrote: 
> > Hi Everyone, 
> > 
> > Please Fix This issue 
> > 
> > This website is not opening 
> > https://djangopackages.org/ 
> > I need to check packages for my Django app but it's not opening please 
> > fix that 
>
> Works for me 
>
> > -- 
> > 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/5b84cacf-b1ef-43b2-aaf3-e4320e33ceff%40googlegroups.com
>  
> > <
> https://groups.google.com/d/msgid/django-users/5b84cacf-b1ef-43b2-aaf3-e4320e33ceff%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/9b0de8f3-6be6-4704-ac76-61588ba9b24c%40googlegroups.com.


Re: Django Package Website is not opening

2020-05-04 Thread Mike Dewhirst

On 4/05/2020 6:21 pm, Mike Dewhirst wrote:

On 4/05/2020 6:14 pm, Hamza Mirchi wrote:

Hi Everyone,

Please Fix This issue

This website is not opening
https://djangopackages.org/
I need to check packages for my Django app but it's not opening 
please fix that


Works for me


Further to that, it might not be working depending on your geographic 
location. See ...


https://robertheaton.com/2020/04/27/how-does-a-tcp-reset-attack-work/

As it happens I'm in Australia and one of my projects does a bit of web 
scraping looking for specific data. It works perfectly when running on 
my dev or staging server here. However, on the production server running 
on a DigitalOcean droplet in Singapore, there are certain sites in 
Europe which cannot be reached.


It is definitely not the software so I'm left with a puzzle. I suspect 
the internet or the web is being interfered with as per the great 
firewall of China. I don't know whether the interference is European or 
Singaporean but it is definitely there.


Cheers

Mike




--
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/5b84cacf-b1ef-43b2-aaf3-e4320e33ceff%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/a3336136-6ed3-c79f-2814-cadf29ebc131%40dewhirst.com.au.


Re: not a valid UUID.

2020-05-04 Thread Nomeh Uchenna Gabriel
That looks good to you but is definitely a dangerous approach if the "12 
digits" should be unique for each QuerySet since "random.random" can return 
dublicate numbers when called multiple times.

... I suggest you make a function for that or novicely adds the item's 'pk' to 
the random number making sure that it's still not more than 12 digits

-- 
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/71c45bae-8cb2-433d-ae27-2d4275c7182c%40googlegroups.com.


Re: not a valid UUID.

2020-05-04 Thread Nomeh Uchenna Gabriel
[CONTINUED] 
I just saw "unique=true" on that field

... you may not face the problems of using "random" just yet but must face it 
at some "random time in the future" - once you see something like this:

   >>>: IntegrityError

... then shall you remember my reply.

The best option is to use a well guided function - I could even help you with 
that if you don't know much about it on my leisure. 

-- 
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/a55e8d2f-1511-4678-9c9a-1b40a93a8025%40googlegroups.com.


How to get previously uploaded Images in Django

2020-05-04 Thread Nomeh Uchenna Gabriel
You should read about customising the admin here: 
https://docs.djangoproject.com/en/3.0/intro/tutorial07/

... but I suggest that you build your own website control panel which will 
control your website with API's 

-- 
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/37568d09-e5a6-4ab4-be12-ed2881d6d119%40googlegroups.com.


Re: A learner following a Mosh Tutorial on Django and having a problem saving a product to SQLite

2020-05-04 Thread Adedotun Richard
Did you remember to add the models to the admin.py?

>From .models import Product, Offer

admin.site.register(Product)
admin.site.register(Offer)


On Mon, May 4, 2020, 8:02 AM i...@serenityscotland.co.uk/webmail <
i...@serenityscotland.co.uk> wrote:

> Hi Folks,
>
> Here is models.py:
>
> from django.db import models
>
> class Product(models.Model):
> name = models.CharField(max_length=255)
> price = models.FloatField()
> stock = models.IntegerField()
> image_url = models.CharField(max_length=2083)
>
>
> class Offer(models.Model):
> code = models.CharField(max_length=10)
> description = models.CharField(max_length=255)
> discount = models.FloatField()
>
>
> Thank you for any help!
>
>
> Iain
>
>
> On Sun, 3 May 2020 at 23:13, Adedotun Richard 
> wrote:
>
>> Can you paste your model.py class for products?
>> There is probability that you are getting the write-up wrong.
>>
>>
>> On Sat, May 2, 2020, 3:43 PM Iain Stewart 
>> wrote:
>>
>>> Hi Folks,
>>>
>>> I am a learner and am enjoying learning Django so far (about a month
>>> in). I am doing the Mosh Python Tutorial for Begnniners on You Tube and in
>>> trying to save my first product on the Django admin/ products page and got
>>> the following error. I suspect the problem is between Django and SQLite.
>>> Any possible solution would be appreciated. Thanks!
>>> Request Method: POST Request URL: 
>>> http://127.0.0.1:8000/admin/products/product/add/
>>>
>>> 
>>>  Django
>>> Version: 2.1 Python Version: 3.7.7 Installed Applications: 
>>> ['django.contrib.admin',
>>> 'django.contrib.auth', 'django.contrib.contenttypes', 
>>> 'django.contrib.sessions',
>>> 'django.contrib.messages', 'django.contrib.staticfiles', 
>>> 'products.apps.ProductsConfig']
>>> Installed Middleware: ['django.middleware.security.SecurityMiddleware', 
>>> 'django.contrib.sessions.middleware.SessionMiddleware',
>>> 'django.middleware.common.CommonMiddleware', 
>>> 'django.middleware.csrf.CsrfViewMiddleware',
>>> 'django.contrib.auth.middleware.AuthenticationMiddleware', 
>>> 'django.contrib.messages.middleware.MessageMiddleware',
>>> 'django.middleware.clickjacking.XFrameOptionsMiddleware'] Traceback: File
>>> "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\db\backends\
>>> utils.py
>>> "
>>> in _execute 85. return self.cursor.execute(sql, params) File
>>> "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\db\backends\sqlite3\
>>> base.py
>>> "
>>> in execute 296. return Database.Cursor.execute(self, query, params) The
>>> above exception (no such table: main.auth_user__old) was the direct cause
>>> of the following exception: File
>>> "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\core\handlers\
>>> exception.py
>>> "
>>> in inner 34. response = get_response(request) File
>>> "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\core\handlers\
>>> base.py
>>> "
>>> in _get_response 126. response =
>>> self.process_exception_by_middleware(e, request) File
>>> "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\core\handlers\
>>> base.py
>>> "
>>> in _get_response 124. response = wrapped_callback(request,
>>> *callback_args, **callback_kwargs) File
>>> "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\contrib\admin\
>>> options.py
>>> "
>>> in wrapper 607. return self.admin_site.admin_view(view)(*args,
>>> **kwargs) File
>>> "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\utils\
>>> decorators.py
>>> "
>>> in _wrapped_v

Re: A learner following a Mosh Tutorial on Django and having a problem saving a product to SQLite

2020-05-04 Thread Govind Kumar Yadav
can you pls share how your admin.py file looks like

On Monday, 4 May 2020 12:33:03 UTC+5:30, 
ia...@serenityscotland.co.uk/webmail wrote:
>
> Hi Folks, 
>
> Here is models.py:
>
> from django.db import models
>
> class Product(models.Model):
> name = models.CharField(max_length=255)
> price = models.FloatField()
> stock = models.IntegerField()
> image_url = models.CharField(max_length=2083)
>
>
> class Offer(models.Model):
> code = models.CharField(max_length=10)
> description = models.CharField(max_length=255)
> discount = models.FloatField()
>
>
> Thank you for any help!
>
>
> Iain
>
>
> On Sun, 3 May 2020 at 23:13, Adedotun Richard  > wrote:
>
>> Can you paste your model.py class for products?
>> There is probability that you are getting the write-up wrong.
>>
>>
>> On Sat, May 2, 2020, 3:43 PM Iain Stewart > > wrote:
>>
>>> Hi Folks,
>>>
>>> I am a learner and am enjoying learning Django so far (about a month 
>>> in). I am doing the Mosh Python Tutorial for Begnniners on You Tube and in 
>>> trying to save my first product on the Django admin/ products page and got 
>>> the following error. I suspect the problem is between Django and SQLite. 
>>> Any possible solution would be appreciated. Thanks!
>>> Request Method: POST Request URL: 
>>> http://127.0.0.1:8000/admin/products/product/add/ 
>>>
>>> 
>>>  Django 
>>> Version: 2.1 Python Version: 3.7.7 Installed Applications: 
>>> ['django.contrib.admin', 
>>> 'django.contrib.auth', 'django.contrib.contenttypes', 
>>> 'django.contrib.sessions', 
>>> 'django.contrib.messages', 'django.contrib.staticfiles', 
>>> 'products.apps.ProductsConfig'] 
>>> Installed Middleware: ['django.middleware.security.SecurityMiddleware', 
>>> 'django.contrib.sessions.middleware.SessionMiddleware', 
>>> 'django.middleware.common.CommonMiddleware', 
>>> 'django.middleware.csrf.CsrfViewMiddleware', 
>>> 'django.contrib.auth.middleware.AuthenticationMiddleware', 
>>> 'django.contrib.messages.middleware.MessageMiddleware', 
>>> 'django.middleware.clickjacking.XFrameOptionsMiddleware'] Traceback: File 
>>> "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\db\backends\
>>> utils.py 
>>> "
>>>  
>>> in _execute 85. return self.cursor.execute(sql, params) File 
>>> "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\db\backends\sqlite3\
>>> base.py 
>>> "
>>>  
>>> in execute 296. return Database.Cursor.execute(self, query, params) The 
>>> above exception (no such table: main.auth_user__old) was the direct cause 
>>> of the following exception: File 
>>> "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\core\handlers\
>>> exception.py 
>>> "
>>>  
>>> in inner 34. response = get_response(request) File 
>>> "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\core\handlers\
>>> base.py 
>>> "
>>>  
>>> in _get_response 126. response = 
>>> self.process_exception_by_middleware(e, request) File 
>>> "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\core\handlers\
>>> base.py 
>>> "
>>>  
>>> in _get_response 124. response = wrapped_callback(request, 
>>> *callback_args, **callback_kwargs) File 
>>> "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\contrib\admin\
>>> options.py 
>>> "
>>>  
>>> in wrapper 607. return self.admin_site.admin_view(view)(*args, 
>>> **kwargs) File 
>>> "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\utils\
>>> decorators.py 
>>> "
>>>  
>>> in _wrapped_view 142. response = view_func(request

Re: A learner following a Mosh Tutorial on Django and having a problem saving a product to SQLite

2020-05-04 Thread i...@serenityscotland.co.uk/webmail
I think so, from admin.py:

from django.contrib import admin
from .models import Product, Offer

admin.site.register(Product)
admin.site.register(Offer)

On Mon, 4 May 2020 at 13:17, Adedotun Richard  wrote:

> Did you remember to add the models to the admin.py?
>
> From .models import Product, Offer
>
> admin.site.register(Product)
> admin.site.register(Offer)
>
>
> On Mon, May 4, 2020, 8:02 AM i...@serenityscotland.co.uk/webmail <
> i...@serenityscotland.co.uk> wrote:
>
>> Hi Folks,
>>
>> Here is models.py:
>>
>> from django.db import models
>>
>> class Product(models.Model):
>> name = models.CharField(max_length=255)
>> price = models.FloatField()
>> stock = models.IntegerField()
>> image_url = models.CharField(max_length=2083)
>>
>>
>> class Offer(models.Model):
>> code = models.CharField(max_length=10)
>> description = models.CharField(max_length=255)
>> discount = models.FloatField()
>>
>>
>> Thank you for any help!
>>
>>
>> Iain
>>
>>
>> On Sun, 3 May 2020 at 23:13, Adedotun Richard 
>> wrote:
>>
>>> Can you paste your model.py class for products?
>>> There is probability that you are getting the write-up wrong.
>>>
>>>
>>> On Sat, May 2, 2020, 3:43 PM Iain Stewart 
>>> wrote:
>>>
 Hi Folks,

 I am a learner and am enjoying learning Django so far (about a month
 in). I am doing the Mosh Python Tutorial for Begnniners on You Tube and in
 trying to save my first product on the Django admin/ products page and got
 the following error. I suspect the problem is between Django and SQLite.
 Any possible solution would be appreciated. Thanks!
 Request Method: POST Request URL: 
 http://127.0.0.1:8000/admin/products/product/add/

 
  Django
 Version: 2.1 Python Version: 3.7.7 Installed Applications: 
 ['django.contrib.admin',
 'django.contrib.auth', 'django.contrib.contenttypes', 
 'django.contrib.sessions',
 'django.contrib.messages', 'django.contrib.staticfiles', 
 'products.apps.ProductsConfig']
 Installed Middleware: ['django.middleware.security.SecurityMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware', 
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware', 
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware', 
 'django.middleware.clickjacking.XFrameOptionsMiddleware']
 Traceback: File
 "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\db\backends\
 utils.py
 "
 in _execute 85. return self.cursor.execute(sql, params) File
 "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\db\backends\sqlite3\
 base.py
 "
 in execute 296. return Database.Cursor.execute(self, query, params) The
 above exception (no such table: main.auth_user__old) was the direct cause
 of the following exception: File
 "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\core\handlers\
 exception.py
 "
 in inner 34. response = get_response(request) File
 "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\core\handlers\
 base.py
 "
 in _get_response 126. response =
 self.process_exception_by_middleware(e, request) File
 "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\core\handlers\
 base.py
 "
 in _get_response 124. response = wrapped_callback(request,
 *callback_args, **callback_kwargs) File
 "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\contrib\admin\
 options.py
 "
 in wrapper 607. return self.admin_site.admin_view(view)(*args,

Re: A learner following a Mosh Tutorial on Django and having a problem saving a product to SQLite

2020-05-04 Thread i...@serenityscotland.co.uk/webmail
Hi, here it is. Any help much appreciated.

 from admin.py:

from django.contrib import admin
from .models import Product, Offer

admin.site.register(Product)
admin.site.register(Offer)

On Mon, 4 May 2020 at 13:33, Govind Kumar Yadav  wrote:

> can you pls share how your admin.py file looks like
>
> On Monday, 4 May 2020 12:33:03 UTC+5:30,
> ia...@serenityscotland.co.uk/webmail wrote:
>>
>> Hi Folks,
>>
>> Here is models.py:
>>
>> from django.db import models
>>
>> class Product(models.Model):
>> name = models.CharField(max_length=255)
>> price = models.FloatField()
>> stock = models.IntegerField()
>> image_url = models.CharField(max_length=2083)
>>
>>
>> class Offer(models.Model):
>> code = models.CharField(max_length=10)
>> description = models.CharField(max_length=255)
>> discount = models.FloatField()
>>
>>
>> Thank you for any help!
>>
>>
>> Iain
>>
>>
>> On Sun, 3 May 2020 at 23:13, Adedotun Richard  wrote:
>>
>>> Can you paste your model.py class for products?
>>> There is probability that you are getting the write-up wrong.
>>>
>>>
>>> On Sat, May 2, 2020, 3:43 PM Iain Stewart  wrote:
>>>
 Hi Folks,

 I am a learner and am enjoying learning Django so far (about a month
 in). I am doing the Mosh Python Tutorial for Begnniners on You Tube and in
 trying to save my first product on the Django admin/ products page and got
 the following error. I suspect the problem is between Django and SQLite.
 Any possible solution would be appreciated. Thanks!
 Request Method: POST Request URL: 
 http://127.0.0.1:8000/admin/products/product/add/

 
  Django
 Version: 2.1 Python Version: 3.7.7 Installed Applications: 
 ['django.contrib.admin',
 'django.contrib.auth', 'django.contrib.contenttypes', 
 'django.contrib.sessions',
 'django.contrib.messages', 'django.contrib.staticfiles', 
 'products.apps.ProductsConfig']
 Installed Middleware: ['django.middleware.security.SecurityMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware', 
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware', 
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware', 
 'django.middleware.clickjacking.XFrameOptionsMiddleware']
 Traceback: File
 "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\db\backends\
 utils.py
 "
 in _execute 85. return self.cursor.execute(sql, params) File
 "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\db\backends\sqlite3\
 base.py
 "
 in execute 296. return Database.Cursor.execute(self, query, params) The
 above exception (no such table: main.auth_user__old) was the direct cause
 of the following exception: File
 "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\core\handlers\
 exception.py
 "
 in inner 34. response = get_response(request) File
 "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\core\handlers\
 base.py
 "
 in _get_response 126. response =
 self.process_exception_by_middleware(e, request) File
 "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\core\handlers\
 base.py
 "
 in _get_response 124. response = wrapped_callback(request,
 *callback_args, **callback_kwargs) File
 "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\contrib\admin\
 options.py
 "
 in wrapper 607. return self.admin_site.admin_view(view)(*args,
 **kwargs) File
 "C:\Users\user\PycharmProjects\PyShop\venv\lib\site-packages\django\uti

Two forms in one template

2020-05-04 Thread Sergei Sokov
I have two forms in one template, but one of them doesn't  have data to my 
database.
Why does it happen and how to fix it?

When I fill out the Pack form and press "submit" the terminal shows that: 
"POST" /sklad HTTP/1.1" 200 9937
This data doesn't save to my database.

When I fill out the Sklad form and press "submit" the terminal shows that: 
"POST" /sklad HTTP/1.1" 302 0
This data saves to my database fine.

views.py
class SkladCreateView(LoginRequiredMixin, CustomSuccessMessageMixin, 
CreateView):
model = Sklad
template_name = 'sklad.html'
form_class = SkladForm
success_url = reverse_lazy('sklad')
success_msg = 'Материал сохранён'
def get_context_data(self, **kwargs):
kwargs['sklad_form'] = SkladForm
kwargs['pack_form'] = PackForm
kwargs['list_sklad'] = Sklad.objects.all().order_by('material')
kwargs['list_pack'] = Pack.objects.all().order_by('name_pack')
return super().get_context_data(**kwargs) 
def form_valid(self, form):
self.object = form.save(commit=False)
self.object.author = self.request.user
self.object.save()
return super().form_valid(form)

models.py
class Sklad(models.Model):
author = models.ForeignKey(User, on_delete = models.CASCADE, 
verbose_name='автор склада', null=True)
material = models.CharField('название', max_length=200)
unit = models.CharField('единица измерения', max_length=200)
description = models.CharField('описание', max_length=200, null=True)
price_buy = models.IntegerField('цена закупки', )
price_sell = models.IntegerField('цена продажи', )
amount = models.IntegerField('количество', default='0')

def __str__(self):
return self.material

class Pack(models.Model):
author = models.ForeignKey(User, on_delete = models.CASCADE, 
verbose_name='автор упаковки', null=True)
name_pack = models.CharField('название', max_length=100)
price_pack = models.IntegerField('цена', )

def __str__(self):
return self.name_pack


forms.py
class SkladForm(forms.ModelForm):
class Meta:
model = Sklad
fields = (
'material',
'unit',
'description',
'price_buy',
'price_sell',
'amount',
)

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
for field in self.fields:
self.fields[field].widget.attrs['class'] = 'form-control'

class PackForm(forms.ModelForm):
class Meta:
model = Pack
fields = (
'name_pack',
'price_pack',
)

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
for field in self.fields:
self.fields[field].widget.attrs['class'] = 'form-control'


-- 
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/dc035331-23e6-483e-b6d1-ba8847e2abe6%40googlegroups.com.


Re: A learner following a Mosh Tutorial on Django and having a problem saving a product to SQLite

2020-05-04 Thread Sherif Adigun
Did you set up your project in a virtual environment??

If yes, always remember to runserver in the virtual environment

-- 
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/608ab165-00f6-4645-8bdf-a139b98e9685%40googlegroups.com.


Two forms in one template

2020-05-04 Thread Sherif Adigun
Your code is working perfectly. Just that you need to remember that the view 
has its model set to Sklad. Hence, when you called super() on form_valid, only 
the Skald instance is saved.

You need to manually save the Pack form in the form_valid method. 

-- 
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/982b9f71-2cb3-40de-b29b-2caa0618d88d%40googlegroups.com.


Re: Two forms in one template

2020-05-04 Thread Sergei Sokov
I guessed about it.
But I dont know how to do that.

понедельник, 4 мая 2020 г., 18:42:10 UTC+2 пользователь Sherif Adigun 
написал:
>
> Your code is working perfectly. Just that you need to remember that the 
> view has its model set to Sklad. Hence, when you called super() on 
> form_valid, only the Skald instance is saved. 
>
> You need to manually save the Pack form in the form_valid method. 
>

-- 
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/37a078e2-833a-4794-853d-896058ae2c0b%40googlegroups.com.


Page 404 error after running Django server

2020-05-04 Thread Deepti sharma
Hi, I have just started learning django and was trying to make a meeting 
planner project y folllowing a course.
I updated the setting.py file to add website into Instaled_Apps. Then have 
written a function named welcome in views.py
Finally I added it's entry into urls.py fie
But when I run the server, I am getting following error on webpage:

Page not found (404)
Request Method: GET
Request URL: http://127.0.0.1:8000/

Using the URLconf defined in meeting_planner.urls, Django tried these URL 
patterns, in this order:

   1. admin/
   2. welcome.html/

The empty path didn't match any of these.

You're seeing this error because you have DEBUG = True in your Django 
settings file. Change that to False, and Django will display a standard 404 
page.


Can someone please help me with this? I am stuck.



This is my code:  (meeting_planner/website/views.py):

from django.shortcuts import render
from django.http import HttpRequest
# Create your views here.

def welcome(request):
return HttpRequest("Welcome to the Meeting Planner Website!")


(meeting_planner/meeting_planer/urls.py):

from django.contrib import admin
from django.urls import path
from website import views
from django.conf.urls import url,include

from website.views import welcome

urlpatterns = [
path('admin/', admin.site.urls),
path('welcome.html', welcome)
]

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3d38a2c2-3449-4c2f-839e-244b9295f55d%40googlegroups.com.


Re: Page 404 error after running Django server

2020-05-04 Thread 'Amitesh Sahay' via Django users
There are lots of issues with urls.pyPlease go through the django documents on 
how to write urls.py

Sent from Yahoo Mail on Android 
 
  On Mon, 4 May 2020 at 23:39, Deepti sharma wrote:  
 Hi, I have just started learning django and was trying to make a meeting 
planner project y folllowing a course.I updated the setting.py file to add 
website into Instaled_Apps. Then have written a function named welcome in 
views.pyFinally I added it's entry into urls.py fieBut when I run the server, I 
am getting following error on webpage:

Page not found (404)

| Request Method: | GET |
| Request URL: | http://127.0.0.1:8000/ |


Using the URLconf defined in meeting_planner.urls, Django tried these URL 
patterns, in this order:
   
   - admin/
   - welcome.html/

The empty path didn't match any of these.

You're seeing this error because you have DEBUG = True in your Django settings 
file. Change that to False, and Django will display a standard 404 page.




Can someone please help me with this? I am stuck.







This is my code:  (meeting_planner/website/views.py):
from django.shortcuts import render
from django.http import HttpRequest
# Create your views here.

def welcome(request):
return HttpRequest("Welcome to the Meeting Planner Website!")

(meeting_planner/meeting_planer/urls.py):from django.contrib import admin
from django.urls import path
from website import views
from django.conf.urls import url,include

from website.views import welcome

urlpatterns = [
path('admin/', admin.site.urls),
path('welcome.html', welcome)
]



-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3d38a2c2-3449-4c2f-839e-244b9295f55d%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/1203797502.769610.1588615897439%40mail.yahoo.com.


Re: Page 404 error after running Django server

2020-05-04 Thread franz ulenaers

path('welcome.html', welcome)

should be :

path('', welcome)



Op 4/05/2020 om 20:11 schreef 'Amitesh Sahay' via Django users:

There are lots of issues with urls.py
Please go through the django documents on how to write urls.py

Sent from Yahoo Mail on Android 



On Mon, 4 May 2020 at 23:39, Deepti sharma
 wrote:
Hi, I have just started learning django and was trying to make a
meeting planner project y folllowing a course.
I updated the setting.py file to add website into Instaled_Apps.
Then have written a function named welcome in views.py
Finally I added it's entry into urls.py fie
But when I run the server, I am getting following error on webpage:


  Page not found (404)

Request Method: GET
Request URL:http://127.0.0.1:8000/

Using the URLconf defined in |meeting_planner.urls|, Django tried
these URL patterns, in this order:

 1. admin/
 2. welcome.html/

The empty path didn't match any of these.

You're seeing this error because you have |DEBUG = True| in your
Django settings file. Change that to |False|, and Django will
display a standard 404 page.


Can someone please help me with this? I am stuck.



This is my code: (meeting_planner/website/views.py):

from django.shortcutsimport render
from django.httpimport HttpRequest
# Create your views here. def welcome(request):
 return HttpRequest("Welcome to the Meeting Planner Website!")

(meeting_planner/meeting_planer/urls.py):

from django.contribimport admin
from django.urlsimport path
from websiteimport views
from django.conf.urlsimport url,include

from website.viewsimport welcome

urlpatterns = [
 path('admin/', admin.site.urls),
 path('welcome.html', welcome)
]



-- 
You received this message because you are subscribed to the Google

Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it,
send an email to django-users+unsubscr...@googlegroups.com
.
To view this discussion on the web visit

https://groups.google.com/d/msgid/django-users/3d38a2c2-3449-4c2f-839e-244b9295f55d%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/1203797502.769610.1588615897439%40mail.yahoo.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/5eaf7787-ad7c-434a-c848-698bd068b686%40gmail.com.


Re: Page 404 error after running Django server

2020-05-04 Thread Franz Ulenaers
pleae change your urls.py as follow

urlpatterns = [
path('admin/', admin.site.urls),
path('', welcome)
]



Op maandag 4 mei 2020 20:09:51 UTC+2 schreef Deepti sharma:
>
> Hi, I have just started learning django and was trying to make a meeting 
> planner project y folllowing a course.
> I updated the setting.py file to add website into Instaled_Apps. Then have 
> written a function named welcome in views.py
> Finally I added it's entry into urls.py fie
> But when I run the server, I am getting following error on webpage:
>
> Page not found (404)
> Request Method: GET
> Request URL: http://127.0.0.1:8000/
>
> Using the URLconf defined in meeting_planner.urls, Django tried these URL 
> patterns, in this order:
>
>1. admin/
>2. welcome.html/
>
> The empty path didn't match any of these.
>
> You're seeing this error because you have DEBUG = True in your Django 
> settings file. Change that to False, and Django will display a standard 
> 404 page.
>
>
> Can someone please help me with this? I am stuck.
>
>
>
> This is my code:  (meeting_planner/website/views.py):
>
> from django.shortcuts import render
> from django.http import HttpRequest
> # Create your views here.
>
> def welcome(request):
> return HttpRequest("Welcome to the Meeting Planner Website!")
>
>
> (meeting_planner/meeting_planer/urls.py):
>
> from django.contrib import admin
> from django.urls import path
> from website import views
> from django.conf.urls import url,include
>
> from website.views import welcome
>
> urlpatterns = [
> path('admin/', admin.site.urls),
> path('welcome.html', welcome)
> ]
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d02b62d5-caa4-4f5e-a128-e46bd6fa1e08%40googlegroups.com.


Re: Page 404 error after running Django server

2020-05-04 Thread Deepti sharma
Hi, I did replace it with: path('',welcome)
But it's still no working:

Page not found (404)
Request Method: GET
Request URL: http://127.0.0.1:8000/welcome

Using the URLconf defined in meeting_planner.urls, Django tried these URL
patterns, in this order:

   1. admin/
   2.

The current path, welcome, didn't match any of these.

You're seeing this error because you have DEBUG = True in your Django
settings file. Change that to False, and Django will display a standard 404
page.

On Mon, May 4, 2020 at 2:21 PM Franz Ulenaers  wrote:

> pleae change your urls.py as follow
>
> urlpatterns = [
> path('admin/', admin.site.urls),
> path('', welcome)
> ]
>
>
>
> Op maandag 4 mei 2020 20:09:51 UTC+2 schreef Deepti sharma:
>>
>> Hi, I have just started learning django and was trying to make a meeting
>> planner project y folllowing a course.
>> I updated the setting.py file to add website into Instaled_Apps. Then
>> have written a function named welcome in views.py
>> Finally I added it's entry into urls.py fie
>> But when I run the server, I am getting following error on webpage:
>>
>> Page not found (404)
>> Request Method: GET
>> Request URL: http://127.0.0.1:8000/
>>
>> Using the URLconf defined in meeting_planner.urls, Django tried these
>> URL patterns, in this order:
>>
>>1. admin/
>>2. welcome.html/
>>
>> The empty path didn't match any of these.
>>
>> You're seeing this error because you have DEBUG = True in your Django
>> settings file. Change that to False, and Django will display a standard
>> 404 page.
>>
>>
>> Can someone please help me with this? I am stuck.
>>
>>
>>
>> This is my code:  (meeting_planner/website/views.py):
>>
>> from django.shortcuts import render
>> from django.http import HttpRequest
>> # Create your views here.
>>
>> def welcome(request):
>> return HttpRequest("Welcome to the Meeting Planner Website!")
>>
>>
>> (meeting_planner/meeting_planer/urls.py):
>>
>> from django.contrib import admin
>> from django.urls import path
>> from website import views
>> from django.conf.urls import url,include
>>
>> from website.views import welcome
>>
>> urlpatterns = [
>> path('admin/', admin.site.urls),
>> path('welcome.html', welcome)
>> ]
>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/d02b62d5-caa4-4f5e-a128-e46bd6fa1e08%40googlegroups.com
> 
> .
>


-- 
Regards
Deepti Sharma
Blog: https://deepti96.wordpress.com/
Github: https://github.com/dsdeeptisharma
Gitlab: https://gitlab.com/u/dsdeepti
"Great works are not performed by strength but by perseverance"

-- 
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/CAJOjMFcgeruuEKnpB8VFXg1T9Kri6J7o%3Dxb%2BN8JsXGnK57D7Yg%40mail.gmail.com.


Re: A learner following a Mosh Tutorial on Django and having a problem saving a product to SQLite

2020-05-04 Thread Nomeh Uchenna Gabriel
Hi! the reason is probably because you happened to have deleted "some but not 
all of your migrations" 

... django will always look for the latest "sqlmigrate" with the versions in 
the right order(0001,0002,000x...) before it allows "makemigrations" add a new 
one.

To fix, this you must:

delete all your migration files located at "app_Name/migrations" then run 

>>> py manage.py makemigrations [app_Name]


>>> py manage.py migrate [app_Name]

...you can skip app_Name if it's the only app in your project but I advise you 
add it anyway. 

after that you can run:
>>> py manage.py sqlmigrate [app_Name]0001

if that shows your latest migrations, then it's done bro! your project should 
work now.

also check out your migrations and see how django added the new one. 

where app_Name === your app name (the one that you added to 'installed_apps' of 
settings.py

-- 
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/8d1564bb-67c9-4215-8a2b-92afa3e0bcab%40googlegroups.com.


Re: Page 404 error after running Django server

2020-05-04 Thread R D Saini
path("welcome/",views.welcom),

On Mon 4 May, 2020, 11:42 PM 'Amitesh Sahay' via Django users, <
django-users@googlegroups.com> wrote:

> There are lots of issues with urls.py
> Please go through the django documents on how to write urls.py
>
> Sent from Yahoo Mail on Android
> 
>
> On Mon, 4 May 2020 at 23:39, Deepti sharma
>  wrote:
> Hi, I have just started learning django and was trying to make a meeting
> planner project y folllowing a course.
> I updated the setting.py file to add website into Instaled_Apps. Then have
> written a function named welcome in views.py
> Finally I added it's entry into urls.py fie
> But when I run the server, I am getting following error on webpage:
>
> Page not found (404)
> Request Method: GET
> Request URL: http://127.0.0.1:8000/
>
> Using the URLconf defined in meeting_planner.urls, Django tried these URL
> patterns, in this order:
>
>1. admin/
>2. welcome.html/
>
> The empty path didn't match any of these.
>
> You're seeing this error because you have DEBUG = True in your Django
> settings file. Change that to False, and Django will display a standard
> 404 page.
>
>
> Can someone please help me with this? I am stuck.
>
>
>
> This is my code:  (meeting_planner/website/views.py):
>
> from django.shortcuts import render
> from django.http import HttpRequest
> # Create your views here.
>
> def welcome(request):
> return HttpRequest("Welcome to the Meeting Planner Website!")
>
>
> (meeting_planner/meeting_planer/urls.py):
>
> from django.contrib import admin
> from django.urls import path
> from website import views
> from django.conf.urls import url,include
>
> from website.views import welcome
>
> urlpatterns = [
> path('admin/', admin.site.urls),
> path('welcome.html', welcome)
> ]
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/3d38a2c2-3449-4c2f-839e-244b9295f55d%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/1203797502.769610.1588615897439%40mail.yahoo.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/CAL-j-zc8L27BKFgPhgtQ5JX-xMrukh8ZQCej_4v6jd6_%3DpiZmw%40mail.gmail.com.


Re: Page 404 error after running Django server

2020-05-04 Thread Deepti sharma
@rdsaini...@gmail.com
I updated it with: path("welcome/",views.welcome),
But  no success.

Error at http://127.0.0.1:8000/welcome :

TypeError at /welcome/

__init__() takes 1 positional argument but 2 were given

Request Method: GET
Request URL: http://127.0.0.1:8000/welcome/
Django Version: 3.0.5
Exception Type: TypeError
Exception Value:

__init__() takes 1 positional argument but 2 were given

Exception Location:
C:\Users\deeptish\PycharmProjects\GettingStartedDjango\meeting_planner\website\views.py
in welcome, line 6
Python Executable:
C:\Users\deeptish\PycharmProjects\GettingStartedDjango\venv\Scripts\python.exe
Python Version: 3.7.7
Python Path:

['C:\\Users\\deeptish\\PycharmProjects\\GettingStartedDjango\\meeting_planner',
 
'C:\\Users\\deeptish\\AppData\\Local\\Programs\\Python\\Python37\\python37.zip',
 'C:\\Users\\deeptish\\AppData\\Local\\Programs\\Python\\Python37\\DLLs',
 'C:\\Users\\deeptish\\AppData\\Local\\Programs\\Python\\Python37\\lib',
 'C:\\Users\\deeptish\\AppData\\Local\\Programs\\Python\\Python37',
 'C:\\Users\\deeptish\\PycharmProjects\\GettingStartedDjango\\venv',
 
'C:\\Users\\deeptish\\PycharmProjects\\GettingStartedDjango\\venv\\lib\\site-packages']

Server time: Mon, 4 May 2020 18:40:54 +
Traceback Switch to copy-and-paste view 

   -
   
C:\Users\deeptish\PycharmProjects\GettingStartedDjango\venv\lib\site-packages\django\core\handlers\exception.py
in inner
   1.

  response = get_response(request)

  …
   ▶ Local vars 
   -
   
C:\Users\deeptish\PycharmProjects\GettingStartedDjango\venv\lib\site-packages\django\core\handlers\base.py
in _get_response
   1.

  response =
self.process_exception_by_middleware(e, request)

  …
   ▶ Local vars 
   -
   
C:\Users\deeptish\PycharmProjects\GettingStartedDjango\venv\lib\site-packages\django\core\handlers\base.py
in _get_response
   1.

  response = wrapped_callback(request,
*callback_args, **callback_kwargs)





On Mon, May 4, 2020 at 2:37 PM R D Saini  wrote:

> path("welcome/",views.welcom),
>
> On Mon 4 May, 2020, 11:42 PM 'Amitesh Sahay' via Django users, <
> django-users@googlegroups.com> wrote:
>
>> There are lots of issues with urls.py
>> Please go through the django documents on how to write urls.py
>>
>> Sent from Yahoo Mail on Android
>> 
>>
>> On Mon, 4 May 2020 at 23:39, Deepti sharma
>>  wrote:
>> Hi, I have just started learning django and was trying to make a meeting
>> planner project y folllowing a course.
>> I updated the setting.py file to add website into Instaled_Apps. Then
>> have written a function named welcome in views.py
>> Finally I added it's entry into urls.py fie
>> But when I run the server, I am getting following error on webpage:
>>
>> Page not found (404)
>> Request Method: GET
>> Request URL: http://127.0.0.1:8000/
>>
>> Using the URLconf defined in meeting_planner.urls, Django tried these
>> URL patterns, in this order:
>>
>>1. admin/
>>2. welcome.html/
>>
>> The empty path didn't match any of these.
>>
>> You're seeing this error because you have DEBUG = True in your Django
>> settings file. Change that to False, and Django will display a standard
>> 404 page.
>>
>>
>> Can someone please help me with this? I am stuck.
>>
>>
>>
>> This is my code:  (meeting_planner/website/views.py):
>>
>> from django.shortcuts import render
>> from django.http import HttpRequest
>> # Create your views here.
>>
>> def welcome(request):
>> return HttpRequest("Welcome to the Meeting Planner Website!")
>>
>>
>> (meeting_planner/meeting_planer/urls.py):
>>
>> from django.contrib import admin
>> from django.urls import path
>> from website import views
>> from django.conf.urls import url,include
>>
>> from website.views import welcome
>>
>> urlpatterns = [
>> path('admin/', admin.site.urls),
>> path('welcome.html', welcome)
>> ]
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/3d38a2c2-3449-4c2f-839e-244b9295f55d%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://

Re: Page 404 error after running Django server

2020-05-04 Thread 'Amitesh Sahay' via Django users
path("", views.welcome)
This should work

Sent from Yahoo Mail on Android 
 
  On Tue, 5 May 2020 at 0:13, Deepti sharma wrote:   
@rdsaini...@gmail.com I updated it with: path("welcome/",views.welcome),But  no 
success.
Error at http://127.0.0.1:8000/welcome :

TypeError at /welcome/
__init__() takes 1 positional argument but 2 were given
| Request Method: | GET |
| Request URL: | http://127.0.0.1:8000/welcome/ |
| Django Version: | 3.0.5 |
| Exception Type: | TypeError |
| Exception Value: | __init__() takes 1 positional argument but 2 were given |
| Exception Location: | 
C:\Users\deeptish\PycharmProjects\GettingStartedDjango\meeting_planner\website\views.py
 in welcome, line 6 |
| Python Executable: | 
C:\Users\deeptish\PycharmProjects\GettingStartedDjango\venv\Scripts\python.exe |
| Python Version: | 3.7.7 |
| Python Path: | 
['C:\\Users\\deeptish\\PycharmProjects\\GettingStartedDjango\\meeting_planner',
 
'C:\\Users\\deeptish\\AppData\\Local\\Programs\\Python\\Python37\\python37.zip',
 'C:\\Users\\deeptish\\AppData\\Local\\Programs\\Python\\Python37\\DLLs',
 'C:\\Users\\deeptish\\AppData\\Local\\Programs\\Python\\Python37\\lib',
 'C:\\Users\\deeptish\\AppData\\Local\\Programs\\Python\\Python37',
 'C:\\Users\\deeptish\\PycharmProjects\\GettingStartedDjango\\venv',
 
'C:\\Users\\deeptish\\PycharmProjects\\GettingStartedDjango\\venv\\lib\\site-packages']
 |
| Server time: | Mon, 4 May 2020 18:40:54 + |


Traceback Switch to copy-and-paste view
   
   - 
C:\Users\deeptish\PycharmProjects\GettingStartedDjango\venv\lib\site-packages\django\core\handlers\exception.py
 in inner  
  -   response = get_response(request) …
▶ Local vars
   - 
C:\Users\deeptish\PycharmProjects\GettingStartedDjango\venv\lib\site-packages\django\core\handlers\base.py
 in _get_response  
  -   response = 
self.process_exception_by_middleware(e, request) …
▶ Local vars
   - 
C:\Users\deeptish\PycharmProjects\GettingStartedDjango\venv\lib\site-packages\django\core\handlers\base.py
 in _get_response  
  -   response = wrapped_callback(request, 
*callback_args, **callback_kwargs) 




On Mon, May 4, 2020 at 2:37 PM R D Saini  wrote:

path("welcome/",views.welcom),
On Mon 4 May, 2020, 11:42 PM 'Amitesh Sahay' via Django users, 
 wrote:

There are lots of issues with urls.pyPlease go through the django documents on 
how to write urls.py

Sent from Yahoo Mail on Android 
 
  On Mon, 4 May 2020 at 23:39, Deepti sharma wrote:  
 Hi, I have just started learning django and was trying to make a meeting 
planner project y folllowing a course.I updated the setting.py file to add 
website into Instaled_Apps. Then have written a function named welcome in 
views.pyFinally I added it's entry into urls.py fieBut when I run the server, I 
am getting following error on webpage:

Page not found (404)

| Request Method: | GET |
| Request URL: | http://127.0.0.1:8000/ |


Using the URLconf defined in meeting_planner.urls, Django tried these URL 
patterns, in this order:
   
   - admin/
   - welcome.html/

The empty path didn't match any of these.

You're seeing this error because you have DEBUG = True in your Django settings 
file. Change that to False, and Django will display a standard 404 page.




Can someone please help me with this? I am stuck.







This is my code:  (meeting_planner/website/views.py):
from django.shortcuts import render
from django.http import HttpRequest
# Create your views here.

def welcome(request):
return HttpRequest("Welcome to the Meeting Planner Website!")

(meeting_planner/meeting_planer/urls.py):from django.contrib import admin
from django.urls import path
from website import views
from django.conf.urls import url,include

from website.views import welcome

urlpatterns = [
path('admin/', admin.site.urls),
path('welcome.html', welcome)
]



-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3d38a2c2-3449-4c2f-839e-244b9295f55d%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/1203797502.769610.1588615897439%40mail.yahoo.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/CAL-j-zc8L27BKFgPhgtQ5JX-xMrukh8ZQCej_4v6

Re: Page 404 error after running Django server

2020-05-04 Thread 'Amitesh Sahay' via Django users
Please import HttpResponse , 
HttpRequest will not work

Sent from Yahoo Mail on Android 
 
  On Tue, 5 May 2020 at 0:14, Amitesh Sahay wrote:   
path("", views.welcome)
This should work

Sent from Yahoo Mail on Android 
 
  On Tue, 5 May 2020 at 0:13, Deepti sharma wrote:   
@rdsaini...@gmail.com I updated it with: path("welcome/",views.welcome),But  no 
success.
Error at http://127.0.0.1:8000/welcome :

TypeError at /welcome/
__init__() takes 1 positional argument but 2 were given
| Request Method: | GET |
| Request URL: | http://127.0.0.1:8000/welcome/ |
| Django Version: | 3.0.5 |
| Exception Type: | TypeError |
| Exception Value: | __init__() takes 1 positional argument but 2 were given |
| Exception Location: | 
C:\Users\deeptish\PycharmProjects\GettingStartedDjango\meeting_planner\website\views.py
 in welcome, line 6 |
| Python Executable: | 
C:\Users\deeptish\PycharmProjects\GettingStartedDjango\venv\Scripts\python.exe |
| Python Version: | 3.7.7 |
| Python Path: | 
['C:\\Users\\deeptish\\PycharmProjects\\GettingStartedDjango\\meeting_planner',
 
'C:\\Users\\deeptish\\AppData\\Local\\Programs\\Python\\Python37\\python37.zip',
 'C:\\Users\\deeptish\\AppData\\Local\\Programs\\Python\\Python37\\DLLs',
 'C:\\Users\\deeptish\\AppData\\Local\\Programs\\Python\\Python37\\lib',
 'C:\\Users\\deeptish\\AppData\\Local\\Programs\\Python\\Python37',
 'C:\\Users\\deeptish\\PycharmProjects\\GettingStartedDjango\\venv',
 
'C:\\Users\\deeptish\\PycharmProjects\\GettingStartedDjango\\venv\\lib\\site-packages']
 |
| Server time: | Mon, 4 May 2020 18:40:54 + |


Traceback Switch to copy-and-paste view
   
   - 
C:\Users\deeptish\PycharmProjects\GettingStartedDjango\venv\lib\site-packages\django\core\handlers\exception.py
 in inner  
  -   response = get_response(request) …
▶ Local vars
   - 
C:\Users\deeptish\PycharmProjects\GettingStartedDjango\venv\lib\site-packages\django\core\handlers\base.py
 in _get_response  
  -   response = 
self.process_exception_by_middleware(e, request) …
▶ Local vars
   - 
C:\Users\deeptish\PycharmProjects\GettingStartedDjango\venv\lib\site-packages\django\core\handlers\base.py
 in _get_response  
  -   response = wrapped_callback(request, 
*callback_args, **callback_kwargs) 




On Mon, May 4, 2020 at 2:37 PM R D Saini  wrote:

path("welcome/",views.welcom),
On Mon 4 May, 2020, 11:42 PM 'Amitesh Sahay' via Django users, 
 wrote:

There are lots of issues with urls.pyPlease go through the django documents on 
how to write urls.py

Sent from Yahoo Mail on Android 
 
  On Mon, 4 May 2020 at 23:39, Deepti sharma wrote:  
 Hi, I have just started learning django and was trying to make a meeting 
planner project y folllowing a course.I updated the setting.py file to add 
website into Instaled_Apps. Then have written a function named welcome in 
views.pyFinally I added it's entry into urls.py fieBut when I run the server, I 
am getting following error on webpage:

Page not found (404)

| Request Method: | GET |
| Request URL: | http://127.0.0.1:8000/ |


Using the URLconf defined in meeting_planner.urls, Django tried these URL 
patterns, in this order:
   
   - admin/
   - welcome.html/

The empty path didn't match any of these.

You're seeing this error because you have DEBUG = True in your Django settings 
file. Change that to False, and Django will display a standard 404 page.




Can someone please help me with this? I am stuck.







This is my code:  (meeting_planner/website/views.py):
from django.shortcuts import render
from django.http import HttpRequest
# Create your views here.

def welcome(request):
return HttpRequest("Welcome to the Meeting Planner Website!")

(meeting_planner/meeting_planer/urls.py):from django.contrib import admin
from django.urls import path
from website import views
from django.conf.urls import url,include

from website.views import welcome

urlpatterns = [
path('admin/', admin.site.urls),
path('welcome.html', welcome)
]



-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3d38a2c2-3449-4c2f-839e-244b9295f55d%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/1203797502.769610.1588615897439%40mail.yahoo.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...@go

Re: Page 404 error after running Django server

2020-05-04 Thread Jorge Gimeno
I just realized that the view is returning an HttpRequest.  It should be an
HttpResponse object (and the import should be changed to bring that object
in as well).

-Jorge

On Mon, May 4, 2020 at 11:43 AM Deepti sharma 
wrote:

> @rdsaini...@gmail.com
> I updated it with: path("welcome/",views.welcome),
> But  no success.
>
> Error at http://127.0.0.1:8000/welcome :
>
> TypeError at /welcome/
>
> __init__() takes 1 positional argument but 2 were given
>
> Request Method: GET
> Request URL: http://127.0.0.1:8000/welcome/
> Django Version: 3.0.5
> Exception Type: TypeError
> Exception Value:
>
> __init__() takes 1 positional argument but 2 were given
>
> Exception Location: 
> C:\Users\deeptish\PycharmProjects\GettingStartedDjango\meeting_planner\website\views.py
> in welcome, line 6
> Python Executable:
> C:\Users\deeptish\PycharmProjects\GettingStartedDjango\venv\Scripts\python.exe
> Python Version: 3.7.7
> Python Path:
>
> ['C:\\Users\\deeptish\\PycharmProjects\\GettingStartedDjango\\meeting_planner',
>  
> 'C:\\Users\\deeptish\\AppData\\Local\\Programs\\Python\\Python37\\python37.zip',
>  'C:\\Users\\deeptish\\AppData\\Local\\Programs\\Python\\Python37\\DLLs',
>  'C:\\Users\\deeptish\\AppData\\Local\\Programs\\Python\\Python37\\lib',
>  'C:\\Users\\deeptish\\AppData\\Local\\Programs\\Python\\Python37',
>  'C:\\Users\\deeptish\\PycharmProjects\\GettingStartedDjango\\venv',
>  
> 'C:\\Users\\deeptish\\PycharmProjects\\GettingStartedDjango\\venv\\lib\\site-packages']
>
> Server time: Mon, 4 May 2020 18:40:54 +
> Traceback Switch to copy-and-paste view 
>
>-
>
> C:\Users\deeptish\PycharmProjects\GettingStartedDjango\venv\lib\site-packages\django\core\handlers\exception.py
> in inner
>1.
>
>   response = get_response(request)
>
>   …
>▶ Local vars 
>-
>
> C:\Users\deeptish\PycharmProjects\GettingStartedDjango\venv\lib\site-packages\django\core\handlers\base.py
> in _get_response
>1.
>
>   response = self.process_exception_by_middleware(e, 
> request)
>
>   …
>▶ Local vars 
>-
>
> C:\Users\deeptish\PycharmProjects\GettingStartedDjango\venv\lib\site-packages\django\core\handlers\base.py
> in _get_response
>1.
>
>   response = wrapped_callback(request, *callback_args, 
> **callback_kwargs)
>
>
>
>
>
> On Mon, May 4, 2020 at 2:37 PM R D Saini  wrote:
>
>> path("welcome/",views.welcom),
>>
>> On Mon 4 May, 2020, 11:42 PM 'Amitesh Sahay' via Django users, <
>> django-users@googlegroups.com> wrote:
>>
>>> There are lots of issues with urls.py
>>> Please go through the django documents on how to write urls.py
>>>
>>> Sent from Yahoo Mail on Android
>>> 
>>>
>>> On Mon, 4 May 2020 at 23:39, Deepti sharma
>>>  wrote:
>>> Hi, I have just started learning django and was trying to make a meeting
>>> planner project y folllowing a course.
>>> I updated the setting.py file to add website into Instaled_Apps. Then
>>> have written a function named welcome in views.py
>>> Finally I added it's entry into urls.py fie
>>> But when I run the server, I am getting following error on webpage:
>>>
>>> Page not found (404)
>>> Request Method: GET
>>> Request URL: http://127.0.0.1:8000/
>>>
>>> Using the URLconf defined in meeting_planner.urls, Django tried these
>>> URL patterns, in this order:
>>>
>>>1. admin/
>>>2. welcome.html/
>>>
>>> The empty path didn't match any of these.
>>>
>>> You're seeing this error because you have DEBUG = True in your Django
>>> settings file. Change that to False, and Django will display a standard
>>> 404 page.
>>>
>>>
>>> Can someone please help me with this? I am stuck.
>>>
>>>
>>>
>>> This is my code:  (meeting_planner/website/views.py):
>>>
>>> from django.shortcuts import render
>>> from django.http import HttpRequest
>>> # Create your views here.
>>>
>>> def welcome(request):
>>> return HttpRequest("Welcome to the Meeting Planner Website!")
>>>
>>>
>>> (meeting_planner/meeting_planer/urls.py):
>>>
>>> from django.contrib import admin
>>> from django.urls import path
>>> from website import views
>>> from django.conf.urls import url,include
>>>
>>> from website.views import welcome
>>>
>>> urlpatterns = [
>>> path('admin/', admin.site.urls),
>>> path('welcome.html', welcome)
>>> ]
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/3d38a2c2-3449-4c2f-839e-244b9295f55d%40googlegroups.com
>>> 

[no subject]

2020-05-04 Thread fahad rasool
In my django project ,when a user sign up, a form is redirected to fill
user information,further iam displaying this info on other page ,but whats
happening is when i am dislaying the information of the current user who
had logged in ,information of all users is displayed who had been signed up
earlier.

-- 
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/CACqgSmCraF9id7A24CX%2B1gFHnnknoskE4ZBV-LFj6se1nHfmTQ%40mail.gmail.com.


Page 404 error after running Django server

2020-05-04 Thread Nomeh Uchenna Gabriel
Hi! you're just visiting a different url from what you specified in your 
"urls.py" file.

look closely at the routes "django" is telling you that it tried:

[admin/, welcome.html/]

... these are truly the two paths that you specified, why on earth are you 
trying to visit a non-existing path(http://127.0.0.1:8000/)

... kindly visit (http://127.0.0.1:8000/welcome.html)

and face your next error in the "views.py" file ('HttpRequest' instead of 
'HttpResponse') 

-- 
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/f9c805f3-c264-46c6-ab20-153b3c7b9291%40googlegroups.com.


Re:

2020-05-04 Thread Ernest Thuku
It means you have put remember password on in your browser settings..so the
information that you have registered in a form from a user will be
displayed.

On Mon, May 4, 2020, 21:53 fahad rasool  wrote:

> In my django project ,when a user sign up, a form is redirected to fill
> user information,further iam displaying this info on other page ,but whats
> happening is when i am dislaying the information of the current user who
> had logged in ,information of all users is displayed who had been signed up
> earlier.
>
> --
> 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/CACqgSmCraF9id7A24CX%2B1gFHnnknoskE4ZBV-LFj6se1nHfmTQ%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/CAPsfuofX_-iKHYpa%3D5gDjxLzsGb7CcpYu8coiWvUb4piawD%2Bhg%40mail.gmail.com.


Re: Re:

2020-05-04 Thread fahad rasool
On Mon, 4 May 2020, 12:47 am Motaz Hejaze,  wrote:

> first remove all whitespaces in urls.py
>
> ' login' should be 'login'
>
> and then rename your login view to something else , maybe custom_login ,
> or put your app urls before admin panel urls
>
> On Sun, May 3, 2020 at 6:42 PM fahad rasool 
> wrote:
>
>> Apps url.py
>>
>> On Sun, 3 May 2020, 8:27 pm 'Amitesh Sahay' via Django users, <
>> django-users@googlegroups.com> wrote:
>>
>>> please show your app's urls.py, as well the errors
>>>
>>> Regards,
>>> Amitesh
>>>
>>>
>>> On Sunday, 3 May, 2020, 07:53:47 pm IST, fahad rasool <
>>> rasoolfahad...@gmail.com> wrote:
>>>
>>>
>>> Than also it is not working
>>>
>>> On Sun, 3 May 2020, 7:44 pm 'Amitesh Sahay' via Django users, <
>>> django-users@googlegroups.com> wrote:
>>>
>>> it should be *return redirect('login')*
>>>
>>> please check
>>>
>>> On Sunday, 3 May, 2020, 07:34:11 pm IST, fahad rasool <
>>> rasoolfahad...@gmail.com> wrote:
>>>
>>>
>>>
>>> I am unable to redirect to my login page from signup page and nor i am
>>> able to store sign up form details in the database .please someone help its
>>> urgent..
>>>
>>> --
>>> 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/CACqgSmBdoviTSbHH%3D8yMo86MO6vpGpHyNQz1FtXgRf-UiL7zYw%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/660971716.362954.1588515193796%40mail.yahoo.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/CACqgSmAwKgU4dVWN72-u2xnvqBz5ThV6CNarukWo%2BFACwN%3DGFQ%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/940225696.366548.1588517794311%40mail.yahoo.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/CACqgSmDYKr5ztuh3meeTCt-fQvnC9OjZ1cMFK2pFAw%3DLM%2BnLoA%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/CAHV4E-csZDBbNz5HKHpto_6mtn%2B2jLOLAzjSgV95dDPX72NfhQ%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/CACqgSmBkjVHxhE9%3DXf8zY3aq9ky0-WQ8MyQaETRpaCwhkeg0Yg%40mail.gmail.com.


Re: Page 404 error after running Django server

2020-05-04 Thread Deepti sharma
Thanks everyone.
I updated HttpRequest with HttpResponse.
Then in urls.py:
I did:
path(‘’, views.welcome)

Its working now

On Mon, May 4, 2020 at 3:06 PM Nomeh Uchenna Gabriel <
nomehgabri...@gmail.com> wrote:

> Hi! you're just visiting a different url from what you specified in your
> "urls.py" file.
>
> look closely at the routes "django" is telling you that it tried:
>
> [admin/, welcome.html/]
>
> ... these are truly the two paths that you specified, why on earth are you
> trying to visit a non-existing path(http://127.0.0.1:8000/)
>
> ... kindly visit (http://127.0.0.1:8000/welcome.html)
>
> and face your next error in the "views.py" file ('HttpRequest' instead of
> 'HttpResponse')
>
> --
> 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/f9c805f3-c264-46c6-ab20-153b3c7b9291%40googlegroups.com
> .
>
-- 
Regards
Deepti Sharma
Blog: https://deepti96.wordpress.com/
Github: https://github.com/dsdeeptisharma
Gitlab: https://gitlab.com/u/dsdeepti
"Great works are not performed by strength but by perseverance"

-- 
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/CAJOjMFd%2BLhnP137V5Ojr990Q90423fAGWu-A9Qc7sf0oMsqiGA%40mail.gmail.com.


Re:

2020-05-04 Thread fahad rasool
No man than also it shows same behaviour

On Tue, 5 May 2020, 12:50 am Ernest Thuku,  wrote:

> It means you have put remember password on in your browser settings..so
> the information that you have registered in a form from a user will be
> displayed.
>
> On Mon, May 4, 2020, 21:53 fahad rasool  wrote:
>
>> In my django project ,when a user sign up, a form is redirected to fill
>> user information,further iam displaying this info on other page ,but whats
>> happening is when i am dislaying the information of the current user who
>> had logged in ,information of all users is displayed who had been signed up
>> earlier.
>>
>> --
>> 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/CACqgSmCraF9id7A24CX%2B1gFHnnknoskE4ZBV-LFj6se1nHfmTQ%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/CAPsfuofX_-iKHYpa%3D5gDjxLzsGb7CcpYu8coiWvUb4piawD%2Bhg%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/CACqgSmDtY7xtTeeFs7VTZH97s%2BnZdOTPjiu2_mcPxLwyuL5S5A%40mail.gmail.com.


Re: A learner following a Mosh Tutorial on Django and having a problem saving a product to SQLite

2020-05-04 Thread Iain Stewart
HI Nomeh,

Thanks for that. I have deleted the migration files, and made migrations
again. Can you clarify exactly the python command:

py manage.py sqlmigrate [app_Name]0001 if my app is called products please
as I am getting:

(venv) C:\Users\user\PycharmProjects\JoanneShop>py manage.py sqlmigrate
products0001
usage: manage.py sqlmigrate [-h] [--database DATABASE] [--backwards]
[--version] [-v {0,1,2,3}] [--settings SETTINGS] [--pythonpath PYTHONPATH]
[--traceback] [--no-color]
app_label migration_name
manage.py sqlmigrate: error: the following arguments are required:
migration_name

Thanks!

Iain


On Mon, 4 May 2020 at 19:32, Nomeh Uchenna Gabriel 
wrote:

> Hi! the reason is probably because you happened to have deleted "some but
> not all of your migrations"
>
> ... django will always look for the latest "sqlmigrate" with the versions
> in the right order(0001,0002,000x...) before it allows "makemigrations" add
> a new one.
>
> To fix, this you must:
>
> delete all your migration files located at "app_Name/migrations" then run
>
> >>> py manage.py makemigrations [app_Name]
>
>
> >>> py manage.py migrate [app_Name]
>
> ...you can skip app_Name if it's the only app in your project but I advise
> you add it anyway.
>
> after that you can run:
> >>> py manage.py sqlmigrate [app_Name]0001
>
> if that shows your latest migrations, then it's done bro! your project
> should work now.
>
> also check out your migrations and see how django added the new one.
>
> where app_Name === your app name (the one that you added to
> 'installed_apps' of settings.py
>
> --
> 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/8d1564bb-67c9-4215-8a2b-92afa3e0bcab%40googlegroups.com
> .
>


-- 
Iain Stewart
2b Priestfield Road
EDINBURGH EH16 5HH SCOTLAND
iain.a.stew...@gmail.com

telephone: 0044 131 662 9123
mobile: 0044 7728 752824

-- 
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/CAAAU1KRDwxmF%2BePaUrWcLZVNNpGYz9rJ%2Bg%2BJetqgydkz%3DxGcVQ%40mail.gmail.com.


Re: A learner following a Mosh Tutorial on Django and having a problem saving a product to SQLite

2020-05-04 Thread Iain Stewart
worked it out, it is:   py manage.py sqlmigrate products 0001 but I am
still not being able to connect into the database from django admin.

On Mon, 4 May 2020 at 20:41, Iain Stewart  wrote:

> HI Nomeh,
>
> Thanks for that. I have deleted the migration files, and made migrations
> again. Can you clarify exactly the python command:
>
> py manage.py sqlmigrate [app_Name]0001 if my app is called products please
> as I am getting:
>
> (venv) C:\Users\user\PycharmProjects\JoanneShop>py manage.py sqlmigrate
> products0001
> usage: manage.py sqlmigrate [-h] [--database DATABASE] [--backwards]
> [--version] [-v {0,1,2,3}] [--settings SETTINGS] [--pythonpath PYTHONPATH]
> [--traceback] [--no-color]
> app_label migration_name
> manage.py sqlmigrate: error: the following arguments are required:
> migration_name
>
> Thanks!
>
> Iain
>
>
> On Mon, 4 May 2020 at 19:32, Nomeh Uchenna Gabriel <
> nomehgabri...@gmail.com> wrote:
>
>> Hi! the reason is probably because you happened to have deleted "some but
>> not all of your migrations"
>>
>> ... django will always look for the latest "sqlmigrate" with the versions
>> in the right order(0001,0002,000x...) before it allows "makemigrations" add
>> a new one.
>>
>> To fix, this you must:
>>
>> delete all your migration files located at "app_Name/migrations" then run
>>
>> >>> py manage.py makemigrations [app_Name]
>>
>>
>> >>> py manage.py migrate [app_Name]
>>
>> ...you can skip app_Name if it's the only app in your project but I
>> advise you add it anyway.
>>
>> after that you can run:
>> >>> py manage.py sqlmigrate [app_Name]0001
>>
>> if that shows your latest migrations, then it's done bro! your project
>> should work now.
>>
>> also check out your migrations and see how django added the new one.
>>
>> where app_Name === your app name (the one that you added to
>> 'installed_apps' of settings.py
>>
>> --
>> 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/8d1564bb-67c9-4215-8a2b-92afa3e0bcab%40googlegroups.com
>> .
>>
>
>
> --
> Iain Stewart
> 2b Priestfield Road
> EDINBURGH EH16 5HH SCOTLAND
> iain.a.stew...@gmail.com
>
> telephone: 0044 131 662 9123
> mobile: 0044 7728 752824
>
>
>
>

-- 
Iain Stewart
2b Priestfield Road
EDINBURGH EH16 5HH SCOTLAND
iain.a.stew...@gmail.com

telephone: 0044 131 662 9123
mobile: 0044 7728 752824

-- 
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/CAAAU1KTMxdSuVk-fRwLcVguXXar1jnso8AOaCYktx-OJqM-ZTw%40mail.gmail.com.


Re: A learner following a Mosh Tutorial on Django and having a problem saving a product to SQLite

2020-05-04 Thread Iain Stewart
that is still not working, thanks for all your help though, any other ideas
appreciated. Could it be that I need an older version of sqlite as this
Mosh tutorial was in 2018?

Iain

On Mon, 4 May 2020 at 20:44, Iain Stewart  wrote:

> worked it out, it is:   py manage.py sqlmigrate products 0001 but I am
> still not being able to connect into the database from django admin.
>
> On Mon, 4 May 2020 at 20:41, Iain Stewart 
> wrote:
>
>> HI Nomeh,
>>
>> Thanks for that. I have deleted the migration files, and made migrations
>> again. Can you clarify exactly the python command:
>>
>> py manage.py sqlmigrate [app_Name]0001 if my app is called products
>> please as I am getting:
>>
>> (venv) C:\Users\user\PycharmProjects\JoanneShop>py manage.py sqlmigrate
>> products0001
>> usage: manage.py sqlmigrate [-h] [--database DATABASE] [--backwards]
>> [--version] [-v {0,1,2,3}] [--settings SETTINGS] [--pythonpath PYTHONPATH]
>> [--traceback] [--no-color]
>> app_label migration_name
>> manage.py sqlmigrate: error: the following arguments are required:
>> migration_name
>>
>> Thanks!
>>
>> Iain
>>
>>
>> On Mon, 4 May 2020 at 19:32, Nomeh Uchenna Gabriel <
>> nomehgabri...@gmail.com> wrote:
>>
>>> Hi! the reason is probably because you happened to have deleted "some
>>> but not all of your migrations"
>>>
>>> ... django will always look for the latest "sqlmigrate" with the
>>> versions in the right order(0001,0002,000x...) before it allows
>>> "makemigrations" add a new one.
>>>
>>> To fix, this you must:
>>>
>>> delete all your migration files located at "app_Name/migrations" then
>>> run
>>>
>>> >>> py manage.py makemigrations [app_Name]
>>>
>>>
>>> >>> py manage.py migrate [app_Name]
>>>
>>> ...you can skip app_Name if it's the only app in your project but I
>>> advise you add it anyway.
>>>
>>> after that you can run:
>>> >>> py manage.py sqlmigrate [app_Name]0001
>>>
>>> if that shows your latest migrations, then it's done bro! your project
>>> should work now.
>>>
>>> also check out your migrations and see how django added the new one.
>>>
>>> where app_Name === your app name (the one that you added to
>>> 'installed_apps' of settings.py
>>>
>>> --
>>> 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/8d1564bb-67c9-4215-8a2b-92afa3e0bcab%40googlegroups.com
>>> .
>>>
>>
>>
>> --
>> Iain Stewart
>> 2b Priestfield Road
>> EDINBURGH EH16 5HH SCOTLAND
>> iain.a.stew...@gmail.com
>>
>> telephone: 0044 131 662 9123
>> mobile: 0044 7728 752824
>>
>>
>>
>>
>
> --
> Iain Stewart
> 2b Priestfield Road
> EDINBURGH EH16 5HH SCOTLAND
> iain.a.stew...@gmail.com
>
> telephone: 0044 131 662 9123
> mobile: 0044 7728 752824
>
>
>
>

-- 
Iain Stewart
2b Priestfield Road
EDINBURGH EH16 5HH SCOTLAND
iain.a.stew...@gmail.com

telephone: 0044 131 662 9123
mobile: 0044 7728 752824

-- 
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/CAAAU1KR8kEDCVXrgY2zxo005A_bm0EZck_zHT6E%2B39%3DcE%3DZcaw%40mail.gmail.com.


Re: A learner following a Mosh Tutorial on Django and having a problem saving a product to SQLite

2020-05-04 Thread Adedotun Richard
The only option now is to help you by  connecting to your system remotely
and see the error messages and try to help you remotely. If that will help

On Mon, May 4, 2020, 8:52 PM Iain Stewart  wrote:

> that is still not working, thanks for all your help though, any other
> ideas appreciated. Could it be that I need an older version of sqlite as
> this Mosh tutorial was in 2018?
>
> Iain
>
> On Mon, 4 May 2020 at 20:44, Iain Stewart 
> wrote:
>
>> worked it out, it is:   py manage.py sqlmigrate products 0001 but I am
>> still not being able to connect into the database from django admin.
>>
>> On Mon, 4 May 2020 at 20:41, Iain Stewart 
>> wrote:
>>
>>> HI Nomeh,
>>>
>>> Thanks for that. I have deleted the migration files, and made migrations
>>> again. Can you clarify exactly the python command:
>>>
>>> py manage.py sqlmigrate [app_Name]0001 if my app is called products
>>> please as I am getting:
>>>
>>> (venv) C:\Users\user\PycharmProjects\JoanneShop>py manage.py sqlmigrate
>>> products0001
>>> usage: manage.py sqlmigrate [-h] [--database DATABASE] [--backwards]
>>> [--version] [-v {0,1,2,3}] [--settings SETTINGS] [--pythonpath PYTHONPATH]
>>> [--traceback] [--no-color]
>>> app_label migration_name
>>> manage.py sqlmigrate: error: the following arguments are required:
>>> migration_name
>>>
>>> Thanks!
>>>
>>> Iain
>>>
>>>
>>> On Mon, 4 May 2020 at 19:32, Nomeh Uchenna Gabriel <
>>> nomehgabri...@gmail.com> wrote:
>>>
 Hi! the reason is probably because you happened to have deleted "some
 but not all of your migrations"

 ... django will always look for the latest "sqlmigrate" with the
 versions in the right order(0001,0002,000x...) before it allows
 "makemigrations" add a new one.

 To fix, this you must:

 delete all your migration files located at "app_Name/migrations" then
 run

 >>> py manage.py makemigrations [app_Name]


 >>> py manage.py migrate [app_Name]

 ...you can skip app_Name if it's the only app in your project but I
 advise you add it anyway.

 after that you can run:
 >>> py manage.py sqlmigrate [app_Name]0001

 if that shows your latest migrations, then it's done bro! your project
 should work now.

 also check out your migrations and see how django added the new one.

 where app_Name === your app name (the one that you added to
 'installed_apps' of settings.py

 --
 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/8d1564bb-67c9-4215-8a2b-92afa3e0bcab%40googlegroups.com
 .

>>>
>>>
>>> --
>>> Iain Stewart
>>> 2b Priestfield Road
>>> EDINBURGH EH16 5HH SCOTLAND
>>> iain.a.stew...@gmail.com
>>>
>>> telephone: 0044 131 662 9123
>>> mobile: 0044 7728 752824
>>>
>>>
>>>
>>>
>>
>> --
>> Iain Stewart
>> 2b Priestfield Road
>> EDINBURGH EH16 5HH SCOTLAND
>> iain.a.stew...@gmail.com
>>
>> telephone: 0044 131 662 9123
>> mobile: 0044 7728 752824
>>
>>
>>
>>
>
> --
> Iain Stewart
> 2b Priestfield Road
> EDINBURGH EH16 5HH SCOTLAND
> iain.a.stew...@gmail.com
>
> telephone: 0044 131 662 9123
> mobile: 0044 7728 752824
>
>
>
> --
> 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/CAAAU1KR8kEDCVXrgY2zxo005A_bm0EZck_zHT6E%2B39%3DcE%3DZcaw%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%2BndhOMEFAZ%2BgA0tSvA85ZdfRwRXDVv%3Dowt2jg7RzingNQ5P9Q%40mail.gmail.com.


Re:

2020-05-04 Thread Adedotun Richard
Can you show your views.py let me check where you get it wrong?

You might be calling a wrong function to handle the output

On Mon, May 4, 2020, 7:53 PM fahad rasool  wrote:

> In my django project ,when a user sign up, a form is redirected to fill
> user information,further iam displaying this info on other page ,but whats
> happening is when i am dislaying the information of the current user who
> had logged in ,information of all users is displayed who had been signed up
> earlier.
>
> --
> 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/CACqgSmCraF9id7A24CX%2B1gFHnnknoskE4ZBV-LFj6se1nHfmTQ%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%2BndhOP0CEYKKZks-sURQcd_71LYGj33AMh_h0EY3aFHHm_fqA%40mail.gmail.com.


Re:

2020-05-04 Thread Adedotun Richard
For the form not saving can you show the error message received? Hope you
did not forget to put csrf_token  above ur form in the template?

And your views.py for the register should be in quote
return redirect ('login')



On Sun, May 3, 2020, 3:04 PM fahad rasool  wrote:

>
> I am unable to redirect to my login page from signup page and nor i am
> able to store sign up form details in the database .please someone help its
> urgent..
>
> --
> 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/CACqgSmBdoviTSbHH%3D8yMo86MO6vpGpHyNQz1FtXgRf-UiL7zYw%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%2BndhOMiCvjoY3e5hnypg0_rHEmymem3mspAnG4Mw6Vc46NKCQ%40mail.gmail.com.


Re:

2020-05-04 Thread Famzaa
please show mw your views.py


On Tue, May 5, 2020 at 1:08 AM Adedotun Richard 
wrote:

> For the form not saving can you show the error message received? Hope you
> did not forget to put csrf_token  above ur form in the template?
>
> And your views.py for the register should be in quote
> return redirect ('login')
>
>
>
> On Sun, May 3, 2020, 3:04 PM fahad rasool 
> wrote:
>
>>
>> I am unable to redirect to my login page from signup page and nor i am
>> able to store sign up form details in the database .please someone help its
>> urgent..
>>
>> --
>> 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/CACqgSmBdoviTSbHH%3D8yMo86MO6vpGpHyNQz1FtXgRf-UiL7zYw%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%2BndhOMiCvjoY3e5hnypg0_rHEmymem3mspAnG4Mw6Vc46NKCQ%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/CAMLTewkzkR0Za6owUBtqxBCsaQt572qbARX2QUBCti_bjSpVYQ%40mail.gmail.com.


Django MySQL database backup and restore to new server

2020-05-04 Thread marc bellazzini
Hello, 

I have Django 2.x running on an old Ubuntu server with a MySQL database. I 
have installed a new Ubuntu 20.04 server on another machine with Django 3.x 
and MySQL. I would like to backup the old Django/mysql database and restore 
it on the new server. What is the best practice for doing this? 

Thanks

Marc
 

-- 
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/d02ce001-cf6c-4cc9-811b-d9d72946c296%40googlegroups.com.


Inner Join Query

2020-05-04 Thread Giovanni Silva
Hello,

I need execute one "complex" query in Django, but I don't know how I can do
that.

This is the query:
select
case
WHEN NetSales_.ORGV = 'OVE2' THEN 'COC'
WHEN NetSales_.ORGV = 'OVE5' THEN 'DOM BOSCO'
WHEN NetSales_.ORGV = 'OVE8' THEN 'ATITUDE'
ELSE 'Outra'
end as 'Marca',
NetSales_.CLIENTE,
Pedidos_.CodigoRecebedor,
NetSales_.CONTACREDITO,
NetSales_.RAZAOSOCIAL,
ClusterizacaoEscolas_.Relacionamento,
Carteira_.GerenteBase,
Carteira_.ConsultorBase,
Sum(NetSales_.QTD * -1) as 'Alunos',
Sum(NetSales_.VALOR_TOTAL) as 'Faturamento'
from NetSales_
inner join Pedidos_
on NetSales_.DOCVENDA = Pedidos_.OrdemVenda
inner join ClusterizacaoEscolas_
on NetSales_.CONTACREDITO = ClusterizacaoEscolas_.ContaCredito
inner join Carteira_
on Pedidos_.CodigoRecebedor = Carteira_.CodigoRecebedor
inner join DeParaMateriais_
on NetSales_.MATERIAL = DeParaMateriais_.Material
where NetSales_.MARCA_CANAL in ('Atitude', 'COC', 'Dom Bosco', 'Clinical',
'Cia das Letras')
and EXERCNEW = '2020'
and DeParaMateriais_.Publico = 'Aluno'
and DeParaMateriais_.Bimestre = '001'
group by
NetSales_.ORGV,
NetSales_.CLIENTE,
Pedidos_.CodigoRecebedor,
NetSales_.CONTACREDITO,
NetSales_.RAZAOSOCIAL,
ClusterizacaoEscolas_.Relacionamento,
Carteira_.GerenteBase,
Carteira_.ConsultorBase
order by 1

This is my models
from django.db import models

# Create your models here.

class ClusterizacaoEscolas(models.Model):
ContaCredito = models.CharField(max_length=10, db_column='ContaCredito'
, primary_key=True)  # Field name made lowercase.
Relacionamento = models.CharField(max_length=30, db_column=
'Relacionamento')  # Field name made lowercase.
Box = models.CharField(max_length=10, db_column='Box', null=True, blank=
True)  # Field name made lowercase.

class Meta:
managed = False
db_table = 'ClusterizacaoEscolas_'

def __str__(self):
return self.ContaCredito

class NetSales(models.Model):
id = models.IntegerField(null=False, primary_key=True)
CLIENTE = models.CharField(max_length=10, null=True, blank=True)
RAZAOSOCIAL = models.CharField(max_length=35, null=True, blank=True)
CONTACREDITO = models.CharField(max_length=10, null=True, blank=True)
CNPJ = models.CharField(max_length=14, null=True, blank=True)
UF = models.CharField(max_length=2, null=True, blank=True)
CEP = models.CharField(max_length=10, null=True, blank=True)
CIDADE = models.CharField(max_length=50, null=True, blank=True)
BAIRRO = models.CharField(max_length=50, null=True, blank=True)
TELEFONE = models.CharField(max_length=20, null=True, blank=True)
PERIODO = models.IntegerField(null=True, blank=True)
EXERCNEW = models.IntegerField(null=True, blank=True)
MATERIAL = models.CharField(max_length=15, null=True, blank=True)
DESCRICAOMATERIAL = models.CharField(max_length=50, null=True, blank=
True)
ORGV = models.CharField(max_length=4, null=True, blank=True)
QTD = models.IntegerField(null=True, blank=True)
VALOR_TOTAL = models.IntegerField(null=True, blank=True)
LASTYEAR = models.IntegerField(null=True, blank=True)
DISCOUNTS = models.IntegerField(null=True, blank=True)
NPV = models.IntegerField(null=True, blank=True)
RETURNS = models.IntegerField(null=True, blank=True)
TAXES = models.IntegerField(null=True, blank=True)
DTLCTO = models.DateField(null=True, blank=True)
CLASSIFICACAO_SKU = models.CharField(max_length=15, null=True, blank=
True)
SEGMENTO_CATEGORIA = models.CharField(max_length=15, null=True, blank=
True)
DENOMINACAO_CONTA = models.CharField(max_length=15, null=True, blank=
True)
TIPOFAT = models.CharField(max_length=15, null=True, blank=True)
CENLUCRO = models.CharField(max_length=15, null=True, blank=True)
DESCRICAOCENTRODELUCRO = models.CharField(max_length=15, null=True,
blank=True)
DOCREF = models.CharField(max_length=15, null=True, blank=True)
DOCVENDA = models.CharField(max_length=15, null=True, blank=True)
CLASSIF_CONT_DAILY_SALES_GPS = models.CharField(max_length=15, null=True
, blank=True)
CLASSIF_CONT_OFICIAL = models.CharField(max_length=15, null=True, blank=
True)
LOB_CANAL = models.CharField(max_length=15, null=True, blank=True)
MARCA_CANAL = models.CharField(max_length=15, null=True, blank=True)
LOB_PRODUTO = models.CharField(max_length=15, null=True, blank=True)
MARCA_PRODUTO = models.CharField(max_length=15, null=True, blank=True)

class Meta:
managed = False
db_table = 'NetSales_'

def __str__(self):
return self.CLIENTE

class Pedidos(models.Model):
Chave = models.CharField(max_length=45, null=False, blank=False,
primary_key=True)
DocFaturamento = models.CharField(max_length=10, null=True, blank=True)
OrdemVenda = models.CharField(max_length=10, null=True, blank=True)
TipoDocVenda = models.CharField(max_length=5, null=True, blank=True)
OrgVenda = models.CharField(max_length=5, null=True, blank=True)
DataPedido = models.DateF

Dynamic Radio Form

2020-05-04 Thread J.T.
I'm working on an app that will allow the user to select the winner between 
two teams (radio buttons) and I need the info saved to the database. I'm 
having trouble with the radio forms part. I've read the documentation and 
searched Google all day, but I can't seem to wrap my heads around it. 

Here are my models:

class Schedule(models.Model):
LEAGUE_CHOICES = (('HS','HS'), ('NFL', 'NFL'), ('NCAA','NCAA'))
week = models.IntegerField()
game_id = models.IntegerField(unique=True)
away_team = models.CharField(max_length=55)
home_team = models.CharField(max_length=55)
away_id = models.IntegerField(unique=True)
home_id = models.IntegerField(unique=True)
league = models.CharField(max_length=15, choices=LEAGUE_CHOICES)
def __str__(self):
return f'Week {self.week} {self.away_team} vs {self.home_team}'

class Selection(models.Model):
username = models.ForeignKey(User, on_delete=models.CASCADE)
week = models.ForeignKey(Schedule, on_delete=models.CASCADE)
select_one = models.CharField(max_length=50)
select_two = models.CharField(max_length=50)
select_three = models.CharField(max_length=50)
select_four = models.CharField(max_length=50)
select_five = models.CharField(max_length=50)
select_six = models.CharField(max_length=50)
select_seven = models.CharField(max_length=50)
select_eight = models.CharField(max_length=50)
select_nine = models.CharField(max_length=50)
select_ten = models.CharField(max_length=50)
tie_breaker = models.IntegerField()
def __str__(self):
return f'Week {self.week} selections for {self.username}'

Below is a portion of what I want the template to look like when rendered. 
It takes the teams from the "Schedule" model 
and displays them. 
I then want the id of the selection (the value) of each game saved to the 
"Selections" model (select_one, select_two, etc.)
I can't figure out how to tie in the view so it saves the data to the db.
I realize I need to create a forms.py, import it into the view, but that is 
the part I'm having trouble understanding. I don't
know what my forms.py should look like since the team names will change 
weekly and each match-up is it's own radio selection.
Any help is greatly appreciated. Also, if I'm screwing this up on the 
models level, let me know. I realize that could
also be an issue.
JT

1  Oklahoma  Oklahoma State NCAA
1  Texas Christian  Houston NCAA
1  Dallas  Philadelphia NFL
1  Houston  Indianapolis NFL
1  New Orleans  Atlanta NFL





-- 
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/398cb0ad-fb81-49ff-bbee-53aa054b6a17%40googlegroups.com.


Re: My first django app error: FATAL: password authentication failed for user "postgres"

2020-05-04 Thread Pratibha Gupta
Hi Eduardo,

I am exactly in same situation. Configuring django first time from my 
Ubuntu 18.04.3 LTS. Facing the same issue. Did you get solution for it?

Thanks,
Pratibha

On Monday, October 21, 2019 at 11:48:47 PM UTC+11, Eduardo Hidalgo García 
wrote:
>
> Hi Guys, 
>
> Is my first time working with django, I am following youtubes' tutorial 
> from telusko. However I am having troubles, my computer has the following 
> OS: Ubuntu 18.04.3 LTS.
>
> I am running docker images for the postgres and pgAdmin tools, I set up my 
> password in the docker-compose.yml file and is the one I imputed on the 
> setting.py. However every time I try to run it I receive the following 
> error message: 
>
> File 
> "/home/eduardo/Envs/test/lib/python3.6/site-packages/psycopg2/__init__.py", 
> line 126, in connect
> conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
> django.db.utils.OperationalError: FATAL:  password authentication failed 
> for user "postgres"
> FATAL:  password authentication failed for user "postgres"
>
> I have psycop2 in my test environment for python 3, do you might know why 
> is this happening? and how can I fix this problem?
>
> Thanks!
> Eduardo
>

-- 
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/ee592f1e-1aba-4cae-8fa4-d0e34ef57b9a%40googlegroups.com.


[no subject]

2020-05-04 Thread fahad rasool
I am working on project which is a diet planner,for that a user have to
signup ,fill a form and them meal plan is generated,in that i have made two
groups one for admin and other for customer,now i am unable to retroeve
data of the customer who is logged in.

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


Re:

2020-05-04 Thread Motaz Hejaze
What do you need exactly ?? What is the error ?? Do you want to check for
user type in templates or views ??? If this is your question ..


1 - use a custom user model
2 - put user types dictionary in custom user model
3 - in your templates and views check the current user type by using
request.user.type


On Tue, 5 May 2020, 2:39 am fahad rasool,  wrote:

> I am working on project which is a diet planner,for that a user have to
> signup ,fill a form and them meal plan is generated,in that i have made two
> groups one for admin and other for customer,now i am unable to retroeve
> data of the customer who is logged in.
>
> --
> 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/CACqgSmCijsSTAp-r3iXkT6T0XpXifUOyRxZJwJ8C4UWt9PVA3g%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/CAHV4E-es7Y7ZXQ%3DkYZg8KpzLvqcf8D1u0hTS1Ur11uRUVVTfTQ%40mail.gmail.com.


Re:

2020-05-04 Thread Adedotun Richard
Can you see that the Customer is not define that was the reason why it was
underlined. Try and import your app model to your view.py:

from .models import *



On Mon, May 4, 2020, 10:35 PM fahad rasool  wrote:

>
> On Tue, 5 May 2020, 1:30 am Adedotun Richard, 
> wrote:
>
>> Can you show your views.py let me check where you get it wrong?
>>
>> You might be calling a wrong function to handle the output
>>
>> On Mon, May 4, 2020, 7:53 PM fahad rasool 
>> wrote:
>>
>>> In my django project ,when a user sign up, a form is redirected to fill
>>> user information,further iam displaying this info on other page ,but whats
>>> happening is when i am dislaying the information of the current user who
>>> had logged in ,information of all users is displayed who had been signed up
>>> earlier.
>>>
>>> --
>>> 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/CACqgSmCraF9id7A24CX%2B1gFHnnknoskE4ZBV-LFj6se1nHfmTQ%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%2BndhOP0CEYKKZks-sURQcd_71LYGj33AMh_h0EY3aFHHm_fqA%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/CACqgSmCfZ_0eFtYviMpM1U5LiOx9a0S2-ybfjM7K%2Brt6VX8PUQ%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%2BndhONH5D3beE_zRphF%3DdOF0%3DrFSzUtFw1ik32O54iyhosjpg%40mail.gmail.com.