Re: No Reverse Match Error, When creating a new user (new user application) it should direct back to home (to the core application)

2020-04-18 Thread Motaz Hejaze
اعمل اسم الفانكشن الحقيقي مكان اسم ال url او استخدم redirect reverse

On Sun, 19 Apr 2020, 6:35 am Ahmed Khairy, 
wrote:

> For this project, I have made 2 applications: Core and Users
>
> Creating a new user is the 2nd application.
> I am trying to direct the new user after registration to 'home'
>
> I keep getting NoReverse Match Error
>
> This is the view.py this is the code:
>
> def register(request):
> if request.method == 'POST':
> form = UserCreationForm(request.POST)
> if form.is_valid():
> form.save()
> username = form.cleaned_data.get('username')
> messages.success(
> request, f'Account created for {username}
> ! Show us your Designs')
> return redirect('home')
> else:
> form = UserCreationForm()
> return render(request, 'register.html', {'form': form})
>
> This is the url.py in the core application:
>
> urlpatterns = [
> path('', HomeView.as_view(), name='home'),
> path('checkout/', checkout, name='checkout'),
> path('product//', ItemDetailView.as_view(), name='product'),
> path('score/', PostListView.as_view(), name='score'),
> path('register/', user_views.register, name='register'),
> ]
>
>
> What do I need to do to fix this issue,
>
> Thank you all in advance
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/4584668f-3cf5-40fe-930c-69c75b74b23d%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/CAHV4E-eymYMWLhd23iEN%2BJqMMkdLNrA9OxHq41x8EuRrj0bh2Q%40mail.gmail.com.


Re: Watch "django blog gets Html tags in public view || blog || blog-detail page." on YouTube

2020-04-18 Thread Shainny Martinez




El martes, 14 de abril de 2020, 8:13:52 (UTC-6), Anonymous Patel escribió:
>
> https://youtu.be/bdY6R4RPKdE
>
>
> Tu error está en el parámetro de que pasaste a la función redirect
>
> Incorecto: redirect('home')
>
> Correcto: redirect('')
>
> Ya que en tu archivo urls.py le asignaste a HomeView la url '' que es 
> igual a la raíz.
>
>
>
>
>

-- 
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/3cb6ee9f-6c47-417f-b7b0-ce6a912380f7%40googlegroups.com.


No Reverse Match Error, When creating a new user (new user application) it should direct back to home (to the core application)

2020-04-18 Thread Ahmed Khairy
For this project, I have made 2 applications: Core and Users

Creating a new user is the 2nd application.
I am trying to direct the new user after registration to 'home'

I keep getting NoReverse Match Error

This is the view.py this is the code:

def register(request):
if request.method == 'POST':
form = UserCreationForm(request.POST)
if form.is_valid():
form.save()
username = form.cleaned_data.get('username')
messages.success(
request, f'Account created for {username}
! Show us your Designs')
return redirect('home')
else:
form = UserCreationForm()
return render(request, 'register.html', {'form': form})

This is the url.py in the core application: 

urlpatterns = [
path('', HomeView.as_view(), name='home'),
path('checkout/', checkout, name='checkout'),
path('product//', ItemDetailView.as_view(), name='product'),
path('score/', PostListView.as_view(), name='score'),
path('register/', user_views.register, name='register'),
]


What do I need to do to fix this issue, 

Thank you all in advance

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4584668f-3cf5-40fe-930c-69c75b74b23d%40googlegroups.com.


Re: Django Error - 'staticfiles' is not a registered tag library. Must be one of: admin_list admin_modify admin_urls

2020-04-18 Thread rama prakash y
THANK YOU BROOO


On Tuesday, December 17, 2019 at 4:38:39 AM UTC+5:30, Bilim Tr wrote:
>
>
>
> 10 Aralık 2019 Salı 19:00:32 UTC+3 tarihinde Balaji yazdı:
>>
>> Hi
>>
>> I am getting error for every Project.
>>
>> I  created new environment and reinstalled python and Django.
>>
>> emplateSyntaxError at /
>>
>> 'staticfiles' is not a registered tag library. Must be one of:
>> admin_list
>> admin_modify
>> admin_urls
>> cache
>> i18n
>> l10n
>> log
>> propeller
>> static
>> tz
>>
>>
>>
>>
>> -- 
>>
>>
>> *Mr. Shetty Balaji S.Asst. ProfessorDepartment of Information Technology,*
>> *SGGS Institute of Engineering & Technology, Vishnupuri, Nanded.MH.India*
>> *Official: bssh...@sggs.ac.in *
>> *  Mobile: +91-9270696267*
>>
>>

-- 
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/8f3af48b-9e69-4a60-a83a-16c4703cab21%40googlegroups.com.


Re: Tutorial "Writing your first Django App": NoReverseMatch at /polls/ - down at the end of part 3

2020-04-18 Thread Markus Grossniklaus
Thanks a lot Chucky!
No error message
displays at least one dot! fine

http://127.0.0.1:8000/admin/
shows ERR_CONNECTION_REFUSED 
even with no Proxy active and iptables shows no restrictions e.g. 
everything is allowed
How could I debug this?


On Wednesday, April 15, 2020 at 12:27:21 AM UTC+2, Markus Grossniklaus 
wrote:
>
> a) I worked the whole tutorial down to the bottom of part 3
> b) I connect with the browser to http://127.0.0.1:8000/polls/
> c) the result is: NoReverseMatch at /polls/
> d) all project data are attached to this POST in mysite.zip
> e) I think it cannot be a difficult problem -> does anybody see it?
> Thanx for any help!
>
> [image: NoReverseMatch.PNG]
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f3ecb032-80c9-49bf-89da-e1656752fe89%40googlegroups.com.


Best way to create a form wizard

2020-04-18 Thread Francesco
Hi all,

I am working on a form on Django. I would like to create several sections 
of the form, just to let the users insert data in steps.
I would like also to change the questions based on the previous answers of 
the users (for example, if in the first page you tell me you are a male, in 
the second step I would ask you you favourite sport, while if you answer 
that you are a female, I would ask your favourite color).

I would like to have an advice on how to start, and in particular:

   1. Is the "form tools" (
   https://django-formtools.readthedocs.io/en/latest/#) the only way to do 
   this? There is a good tutorial/book, possibly with a working example? (I am 
   pretty new with Python and Django, and I need good resource)
   2. Do I have to creare a single model with all data, or can I manage a 
   model for each page?

Thank you very much!

Francesco

-- 
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/17bb7f94-b696-4a3b-93e5-10682f89688d%40googlegroups.com.


Django render a DynamoDB JSON into a HTML table

2020-04-18 Thread Daniel Pedrajas Pineda
I'm try to use a Django page as front-end using some AWS DynamoDB tables as 
back-end. To do so, I use boto3 library and it gets the data from the table 
correctly but I'm not able to parse the data into a HTML table. I have the 
following in views.py

def history(request):
 itemsid = list()
 agents = list()
 dates = list()
 source = list()
 dynamodb_resource('dynamodb')
 history_table = dynamodb_resource.Table('name_of_the_table')
 all_items = history_table.scan()
 for p in all_items['Items']:
   itemsid.append((p['id'])),
   agents.append((p['agent'])),
   dates.append((p['date'])),
   source.append((p['source']))
return render(request, 'history.html', {'itemsid':itemsid, 'agents':agents, 
'dates':dates, 'source':source}

The issue is that I don't know how to write the html code to show a table 
with the rows: id, agent, date and source. 

I have the following in history.html



  {% for i in itemsid %}
  
{{ i }}
...

but I don't know how to code it (how to loop it) to show the table with the 
lists as source. 

Any idea please about how to parse a Json with the following format into a 
HTML with Django and Python please?. 

JSON from DynamoDB:


{
  'Items: [ {
'id': '94f'
'agent': 'aws'
'date': '04/05
'source': 'case1'
  }, {
'id': 'lk42'
  ...
Thank you so much. I'm new in Django and in programming in general so any help 
is much appreciate. 



-- 
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/0dcfb1d9-a08c-4a90-9be4-cc968f44540d%40googlegroups.com.


Zen of high load & high availability backend

2020-04-18 Thread J . Pablo Martín Cobos
Hi,

I have written a small manifest that I would like to share with the
community.

I hope you like it and entertain you in these days of confinement.

If anyone is interested in contributing, you can do a fork and a pull
request.

English:
https://goinnn.github.io/zen-of-high-load-and-high-availability-backend/index.html
Spanish:
https://goinnn.github.io/zen-of-high-load-and-high-availability-backend/index-es.html

Sincerely,

-- 
Pablo Martín Cobos
Software engineer
Python/Django developer
goi...@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/CALNyWLHoTRhKtbua6fxwdXQPHcsRdh4dL3iV-Q4Owe1nqmad4Q%40mail.gmail.com.


Re: Web page -form-update - not working

2020-04-18 Thread Kasper Laudrup




On 18/04/2020 17.58, Body Abdo wrote:

Hi all;
I have a problem when edit my form ... my page doesn't update



I would start by not ignoring all errors like you do with:

except:
  pass

Errors should be handled or at least logged, not ignored.

That would most likely tell you why it's not working so you don't have 
to guess.


Kind regards,

Kasper Laudrup

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4bf26f00-3023-dc80-e1c5-9ced5e10a761%40stacktrace.dk.


Web page -form-update - not working

2020-04-18 Thread Body Abdo
Hi all;
I have a problem when edit my form ... my page doesn't update

models.py
class Hard_number(models.Model):
hard = (
('SD1', 'SDD1'),
('SD2', 'SDD2'),
('SD3', 'SDD3'),
('SD4', 'SDD4'),
('SD5', 'SDD5'),
('SD6', 'SDD6'),
('SD7', 'SDD7'),
('SD8', 'SDD8'),
('SD9', 'SDD9'),
('SD10','SDD10'),
('SD11','SDD11'),
('SD12','SDD12'),
('SD13','SDD13'),
('SD14','SDD14'),
('SDD15','SDD15'),

)
hard_n = models.CharField(max_length=20, choices=hard)
lend_period = models.CharField(max_length=20)
lend_by = models.CharField(max_length=20)
due_back= models.DateField(null=True, blank=False)

LOAN_STATUS = (
('d', 'Maintaince'),
('o', 'On Loan'),
('a', 'Available')
)
status = models.CharField(max_length=1, choices=LOAN_STATUS, blank= True, 
default='a')

def __str__(self):
return self.hard_n

class Meta:
ordering = ['due_back']
verbose_name = 'Hards'
verbose_name_plural = 'HARDS'
db_table = 'Hard_number'


def get_absolute_url(self):
return reverse('archive:show',args=[str(self.id)])  



views.py
def hard_form(request):
if request.method == "POST":
form = Hard_numberForm(request.POST)
if form.is_valid():
try:
form.save()
return redirect('archive:show')
except:
pass
else:
form = Hard_numberForm()
return render(request, 'hardindex.html', {'form': form})

# https://www.javatpoint.com/django-crud-application

def show_hard(request):
hard = Hard_number.objects.all()
return render(request, "show.html", {"hard": hard})


def edit_hard(request, id ):
hards_update = Hard_number.objects.get(id=id)
return render(request, 'hard_edit.html',{'hards_update': hards_update})


def update_hard(request, id):
hards_update = Hard_number.objects.get(id=id)
form = Hard_numberForm(request.POST,instance=hards_update)
if form.is_valid():
form.save()
return redirect('archive:update')
return render(request, 'hard_edit.html', {'hards_update': hards_update})



urls.py
path('form_hard', views.hard_form, name='form_hard'),
path('form_hard/show', views.show_hard, name='show'),
#path('form_hard/show/edit/', views.edit_hard, name='edit'),
path('form_hard/show/update/', views.update_hard, name='update'),

hard_edit.html





Edit
{% load static %}




{%csrf_token %}
  





 Update Details



Hard number

  


   
Lend period
   
   
   
   
  
  Lend by 
 
 
 
  
  
   Due back
  
  
  
  
  
   status
  
  
  
  
  
  
  

Update
 





-- 
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/df52651a-f8bd-4ef7-8733-1c4ab586c148%40googlegroups.com.


Re: Why my posts are showing up

2020-04-18 Thread Kasper Laudrup

On 18/04/2020 08.54, kelvin smith wrote:

Just created my first post few minutes ago and I haven’t seen it



https://support.google.com/groups/?hl=en#topic=9216

--
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/d0ce8800-a310-5a53-b799-b5bf4f267f75%40stacktrace.dk.


Need help in Django calculated field/queryset

2020-04-18 Thread Jay Prajapati
Hello Everyone,

I need a help from you. I'm learning Django and working on my own project but 
got stuck on a point. Your inputs will be highly appreciated.

Little background: I'm creating a web app like investment portfolio. I have 
created a model based form to input the stock transaction i.e. buy and sell.

class eq_txn(models.Model):
user = models.ForeignKey(User, on_delete=models.CASCADE,)
investor_name = models.CharField(max_length=50)
deal_type = models.CharField(max_length=50)
deal_date = models.DateField()
scrip_name = models.CharField(max_length=50, blank=True)
quantity = models.FloatField(default=0)
price = models.FloatField(default=0)
isin = models.CharField(max_length=50, blank=True)
folio = models.CharField(max_length=50)

def deal_value(self):
  return self.quantity * self.price

I have created a calculated field to derived deal value. Now I'm trying to 
create Cost of Investment and Weighted Average Price (WAP) but no luck yet. 
Please help with this or any alternate workaround for same either by model or 
view. Below is the logic that I want to plot (also i have created the same in 
excel sheet):

Cost of Investment: This will be a cumulative running sum value where deal_type 
is equal to Buy needs to be add in accumulated running total value with similar 
calculation of deal_value and where deal_type is equal to Sell needs to be 
calulated as (WAP)*(quantity) then deduct from cumulative running total value.

WAP: This will be also cumulative running sum value as calulated when deal_type 
is equal to Buy then it should be Cost of Investment devided by Cumulative 
Quantity (May be additional field which can be derived by adding Buy quantity 
and sell quantity should be deducted in running total), When deal_value is Sell 
then it should use previous transaction's calculated WAP.

Here are the codes i have tried through queryset to derived by not worked 
exactly I wanted.

all_txn =eq_txn.objects.annotate(cumqty=Window(Sum(Case(When(deal_type='Buy', 
then='quantity'),
When(deal_type='Sell', then=F('quantity')*-1))), 
partition_by=[F('scheme_name'),], order_by=F('deal_date').asc()), 
cumamt=Window(Sum(Case(When(deal_type='Buy', 
then=F('price')*F('quantity', partition_by=[F('scheme_name'),], 
order_by=F('deal_date').asc()),
)\
 .all().order_by('deal_date').filter(user=request.user)
test = all_txn.annotate(wap=Case(When(deal_type='Buy', 
then=F('cumamt')/F('cumqty'))),
cumamtsale=Case(When(deal_type='Sell', then=(F('wap')*F('quantity')*-1)), 
default=Value('0')),
amt=F('cumamt')+F('cumamtsale')).values().filter(user=request.user)

Thank you !

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


equity cases.xlsx
Description: MS-Excel 2007 spreadsheet


Need help in Django calculated field/queryset

2020-04-18 Thread Jay Prajapati
Hello All,

Hope you are doing well!

I need a help. I'm learning Django and working on my own project but got stuck 
on a point. Your inputs will be highly appreciated.

Little background: I'm creating a web app like investment portfolio. I have 
created a model based form to input the stock transaction i.e. buy and sell.

class eq_txn(models.Model):
user = models.ForeignKey(User, on_delete=models.CASCADE,)
investor_name = models.CharField(max_length=50)
deal_type = models.CharField(max_length=50)
deal_date = models.DateField()
scrip_name = models.CharField(max_length=50, blank=True)
quantity = models.FloatField(default=0)
price = models.FloatField(default=0)
isin = models.CharField(max_length=50, blank=True)
folio = models.CharField(max_length=50)

def deal_value(self):
  return self.quantity * self.price
I have created a calculated field to derived deal value. Now I'm trying to 
create Cost of Investment and Weighted Average Price (WAP) but no luck yet. 
Please help with this or any alternate workaround for same either by model or 
view. Below is the logic that I want to plot:

Cost of Investment: This will be a cumulative running sum value where deal_type 
is equal to Buy needs to be add in accumulated running total value with similar 
calculation of deal_value and where deal_type is equal to Sell needs to be 
calulated as (WAP)*(quantity) then deduct from cumulative running total value.

WAP: This will be also cumulative running sum value as calulated when deal_type 
is equal to Buy then it should be Cost of Investment devided by Cumulative 
Quantity (May be additional field which can be derived by adding Buy quantity 
and sell quantity should be deducted in running total), When deal_value is Sell 
then it should use previous transaction's calculated WAP.

Here are the codes i have tried through queryset to derived by not worked 
exactly I wanted.

all_txn =eq_txn.objects.annotate(cumqty=Window(Sum(Case(When(deal_type='Buy', 
then='quantity'),
When(deal_type='Sell', then=F('quantity')*-1))), 
partition_by=[F('scheme_name'),], order_by=F('deal_date').asc()), 
cumamt=Window(Sum(Case(When(deal_type='Buy', 
then=F('price')*F('quantity', partition_by=[F('scheme_name'),], 
order_by=F('deal_date').asc()),
)\
  .all().order_by('deal_date').filter(user=request.user)
test = all_txn.annotate(wap=Case(When(deal_type='Buy', 
then=F('cumamt')/F('cumqty'))),
cumamtsale=Case(When(deal_type='Sell', then=(F('wap')*F('quantity')*-1)), 
default=Value('0')),
amt=F('cumamt')+F('cumamtsale')).values().filter(user=request.user)

Thank you !

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


Why my posts are showing up

2020-04-18 Thread kelvin smith
Just created my first post few minutes ago and I haven’t seen it

-- 
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/3294376a-2d9a-472b-8435-ef93c5e6cb11%40googlegroups.com.


Re: Reg: Django signal not working

2020-04-18 Thread Saurabh Ranjan Singh
I am having the same issue. Please fix it.

On Friday, 17 April 2020 22:47:40 UTC+5:30, Amitesh Sahay wrote:
>
> Hi,
>
> I am creating a Django signup form through "User" model and 
> "UserCreationForm" and customized the User model to accommodate single user 
> defined field "contact".
>
> However, the signal that I have written seems not to be working.
> Whenever, I am filling the form, I am getting below error:
>
> AttributeError at /auth/register/
> 'User' object has no attribute 'profile'
>
> *Full traceback log as below:*
>
> Installed Applications:
> ['django.contrib.admin',
>  'django.contrib.auth',
>  'django.contrib.contenttypes',
>  'django.contrib.sessions',
>  'django.contrib.messages',
>  'django.contrib.staticfiles',
>  'phone_field',
>  'AUTHENTICATION']
> 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 (most recent call last):
>   File "C:\Python38\lib\site-packages\django\core\handlers\exception.py", 
> line 34, in inner
> response = get_response(request)
>   File "C:\Python38\lib\site-packages\django\core\handlers\base.py", line 
> 115, in _get_response
> response = self.process_exception_by_middleware(e, request)
>   File "C:\Python38\lib\site-packages\django\core\handlers\base.py", line 
> 113, in _get_response
> response = wrapped_callback(request, *callback_args, **callback_kwargs)
>   File "C:\Users\anshu\djago-project\SkoolSkill\AUTHENTICATION\views.py", 
> line 50, in register_user
> save1 = form.save()
>   File "C:\Python38\lib\site-packages\django\contrib\auth\forms.py", line 
> 137, in save
> user.save()
>   File "C:\Python38\lib\site-packages\django\contrib\auth\base_user.py", 
> line 66, in save
> super().save(*args, **kwargs)
>   File "C:\Python38\lib\site-packages\django\db\models\base.py", line 745, 
> in save
> self.save_base(using=using, force_insert=force_insert,
>   File "C:\Python38\lib\site-packages\django\db\models\base.py", line 793, 
> in save_base
> post_save.send(
>   File "C:\Python38\lib\site-packages\django\dispatch\dispatcher.py", line 
> 173, in send
> return [
>   File "C:\Python38\lib\site-packages\django\dispatch\dispatcher.py", line 
> 174, in 
> (receiver, receiver(signal=self, sender=sender, **named))
>   File "C:\Users\anshu\djago-project\SkoolSkill\AUTHENTICATION\models.py", 
> line 17, in save_user_profile
> instance.profile.save()
>
> Exception Type: AttributeError at /auth/register/
> Exception Value: 'User' object has no attribute 'profile'
>
> I have uploaded the project in google drive with below location link, just 
> in case if somebody wishes to test it.
>
>
> https://drive.google.com/file/d/1COB3BBoRb95a85cLi9k1PdIYD3bmlnc0/view?usp=sharing
>
> My environment:
>
> Django==3.0.5 python 3.8.2
>
> Not sure what is the mistake. Please help.
>
> *models.py*
>
> from django.db import models
> from django.contrib.auth.models import User
> from django.db.models.signals import post_save
> from django.dispatch import receiver
>
> class SignUp(models.Model):
> user = models.OneToOneField(User, on_delete=models.CASCADE)
> Contact = models.TextField(max_length=500, blank=True)
>
> @receiver(post_save, sender=User)
> def create_user_profile(sender, instance, created, **kwargs):
> if created:
> SignUp.objects.create(user=instance)
>
> @receiver(post_save, sender=User)
> def save_user_profile(sender, instance, **kwargs):
> *instance.profile.save()*
>
> *forms.py*
>
> from django.contrib.auth.forms import UserCreationForm
> from django.contrib.auth.models import User
> from django import forms
> from  .models import SignUp
>
> class SignUpForm(UserCreationForm):
> email = forms.EmailField()
> first_name = forms.CharField(max_length=100)
> last_name = forms.CharField(max_length=100)
> #phone = format()
>
> class Meta:
> model = User
> fields = ('username', 'first_name', 'last_name', 'email', 
> 'password1', 'password2')
>
>
> class CustomSignUpPage(forms.ModelForm):
> Contact = forms.CharField(max_length=10)
> class Meta:
> model = SignUp
> fields = ('Contact', )
>
> *views.py*
>
> from django.shortcuts import render, redirect
> from django.contrib.auth import authenticate, login, logout
> from django.contrib import messages
> #from django.contrib.auth.forms import UserCreationForm
> from .forms import SignUpForm, CustomSignUpPage
>
> def home(request):
>return render(request, 'authenticate\home.html', {})
>
> def login_user(request):
>if request.method == 'POST':
>   username = request.POST['username']
>   password = request.POST['password']