diff --git a/db.sqlite3 b/db.sqlite3
index 5f123db..919b458 100644
Binary files a/db.sqlite3 and b/db.sqlite3 differ
diff --git a/media/default.jpg b/media/default.jpg
index 330146e..8e55dee 100644
Binary files a/media/default.jpg and b/media/default.jpg differ
diff --git a/taskstodo b/taskstodo
new file mode 100644
index 0000000..4fea0d5
--- /dev/null
+++ b/taskstodo
@@ -0,0 +1,2 @@
+remove images and files on deletion or updation
+redirect not letting pass context
\ No newline at end of file
diff --git a/users/forms.py b/users/forms.py
index b43f55d..4a58857 100644
--- a/users/forms.py
+++ b/users/forms.py
@@ -4,14 +4,25 @@
from django.contrib.auth.forms import UserCreationForm
-class UserForm(UserCreationForm):
+class UserRegisterForm(UserCreationForm):
class Meta:
model = User
- fields = ['username', 'first_name','last_name',
- 'email', 'password1', 'password2']
+ fields = ['username', 'first_name', 'last_name', 'email', 'password1', 'password2']
-class ProfileForm(forms.ModelForm):
+class ProfileRegisterForm(forms.ModelForm):
class Meta:
model = Profile
- fields = ['image', 'rollno', 'year', 'branch', 'techskills','cv']
+ fields = ['image', 'rollno', 'year', 'branch', 'techskills', 'cv']
+
+
+class UserUpdateForm(forms.ModelForm):
+ class Meta:
+ model = User
+ fields = ['username', 'first_name', 'last_name', 'email']
+
+
+class ProfileUpdateForm(forms.ModelForm):
+ class Meta:
+ model = Profile
+ fields = ['image', 'rollno', 'year', 'branch', 'techskills', 'cv']
diff --git a/users/models.py b/users/models.py
index a189366..5887a16 100644
--- a/users/models.py
+++ b/users/models.py
@@ -1,6 +1,6 @@
from django.db import models
from django.contrib.auth.models import User
-
+from PIL import Image
YEAR_CHOICES = (
('1', '1st'),
@@ -22,3 +22,11 @@ class Profile(models.Model):
def __str__(self):
return f"{self.user}({self.rollno})"
+
+ def save(self, *args, **kwargs):
+ super(Profile, self).save(*args, **kwargs)
+ img = Image.open(self.image.path)
+ if img.height > 300 or img.width > 300:
+ dimensions = (300, 300)
+ img.thumbnail(dimensions)
+ img.save(self.image.path)
diff --git a/users/templates/users/profile.html b/users/templates/users/profile.html
index 0d3292c..36dd5b7 100644
--- a/users/templates/users/profile.html
+++ b/users/templates/users/profile.html
@@ -1,5 +1,25 @@
{% extends 'home/base.html' %}
+{% load crispy_forms_tags %}
{% block content %}
Hi {{ user.username }}
You are on profile page.
-
+
+
+