Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assignment-2 #27

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

cookie-shruti
Copy link
Contributor

No description provided.

Copy link
Owner

@friskycodeur friskycodeur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are there two apps django-auth and authentication ?
Apply template inheritance and update the PR.
Make the changes where commented.

class CreateUserForm(UserCreationForm):
class Meta:
model = User
fields = ['email', 'password']
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

email is not a defined field in UserCreationForm , you'll have to create it statically and then add it in fields.
Refer this for help:
https://stackoverflow.com/questions/48049498/django-usercreationform-custom-fields

from django.db import models

# Create your models here.
class User(models.Model):
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not good, User is a pre-defined class, you should name this something else and not User.
Also you don't need to create a User model , it is predefined in django.

"""
userData = User.objects.filter(email = request.POST["email"],password=request.POST["password"])
if userData.exists():
print("user successfully logged in ")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quick-Note: This print will show data on cmd only and not a webpage.

title = models.CharField(max_length=100)
description = models.TextField()

user_id = models.ForeignKey(User,on_delete=models.CASCADE,null=True,blank=True)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change user_id to created_by or author , that will look better.

<h5 class="card-title">{{blog.title}}</h5>

<p class="card-text">{{blog.description}}.</p>
<a href="update/{{blog.id}}" class="btn btn-primary" role="button"> update this blog</a>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not the right way for using href , use {% url 'update-blog' blog.id %}
for both update and delete

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants