diff --git a/db.sqlite3 b/db.sqlite3 deleted file mode 100644 index 31636e77..00000000 Binary files a/db.sqlite3 and /dev/null differ diff --git a/main_app/admin.py b/main_app/admin.py index b2d59166..10a1aa9b 100644 --- a/main_app/admin.py +++ b/main_app/admin.py @@ -1,5 +1,10 @@ from django.contrib import admin +from .models import register_table from .models import contact # Register your models here. admin.site.register(contact) +admin.site.register(register_table) + + + diff --git a/main_app/migrations/0004_profile.py b/main_app/migrations/0004_profile.py new file mode 100644 index 00000000..c59be8c1 --- /dev/null +++ b/main_app/migrations/0004_profile.py @@ -0,0 +1,32 @@ +# Generated by Django 3.0.6 on 2021-04-16 08:02 + +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ('main_app', '0003_merge_20210408_2337'), + ] + + operations = [ + migrations.CreateModel( + name='profile', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('contact_number', models.IntegerField()), + ('profile_pic', models.ImageField(blank=True, null=True, upload_to='profiles/%Y/%m/%d')), + ('age', models.CharField(blank=True, max_length=250, null=True)), + ('city', models.CharField(blank=True, max_length=250, null=True)), + ('about', models.TextField(blank=True, null=True)), + ('gender', models.CharField(default='Male', max_length=250)), + ('occupation', models.CharField(blank=True, max_length=250, null=True)), + ('added_on', models.DateTimeField(auto_now_add=True, null=True)), + ('update_on', models.DateTimeField(auto_now=True, null=True)), + ('username', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), + ], + ), + ] diff --git a/main_app/migrations/0005_delete_profile.py b/main_app/migrations/0005_delete_profile.py new file mode 100644 index 00000000..f443b89a --- /dev/null +++ b/main_app/migrations/0005_delete_profile.py @@ -0,0 +1,16 @@ +# Generated by Django 3.0.6 on 2021-04-16 08:20 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('main_app', '0004_profile'), + ] + + operations = [ + migrations.DeleteModel( + name='profile', + ), + ] diff --git a/main_app/migrations/0006_register_table.py b/main_app/migrations/0006_register_table.py new file mode 100644 index 00000000..539e46d6 --- /dev/null +++ b/main_app/migrations/0006_register_table.py @@ -0,0 +1,32 @@ +# Generated by Django 3.1.7 on 2021-04-16 09:21 + +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ('main_app', '0005_delete_profile'), + ] + + operations = [ + migrations.CreateModel( + name='register_table', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('contact_number', models.IntegerField()), + ('profile_pic', models.ImageField(blank=True, null=True, upload_to='profiles/')), + ('age', models.CharField(blank=True, max_length=250, null=True)), + ('city', models.CharField(blank=True, max_length=250, null=True)), + ('about', models.TextField(blank=True, null=True)), + ('gender', models.CharField(default='Male', max_length=250)), + ('occupation', models.CharField(blank=True, max_length=250, null=True)), + ('added_on', models.DateTimeField(auto_now_add=True, null=True)), + ('update_on', models.DateTimeField(auto_now=True, null=True)), + ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), + ], + ), + ] diff --git a/main_app/migrations/0007_auto_20210416_1710.py b/main_app/migrations/0007_auto_20210416_1710.py new file mode 100644 index 00000000..ed6a7dc6 --- /dev/null +++ b/main_app/migrations/0007_auto_20210416_1710.py @@ -0,0 +1,26 @@ +# Generated by Django 3.1.7 on 2021-04-16 11:40 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('main_app', '0006_register_table'), + ] + + operations = [ + migrations.RemoveField( + model_name='register_table', + name='about', + ), + migrations.RemoveField( + model_name='register_table', + name='occupation', + ), + migrations.AlterField( + model_name='register_table', + name='profile_pic', + field=models.ImageField(blank=True, null=True, upload_to='profiles/%Y/%m/%d'), + ), + ] diff --git a/main_app/migrations/0008_auto_20210416_1718.py b/main_app/migrations/0008_auto_20210416_1718.py new file mode 100644 index 00000000..78e66f8f --- /dev/null +++ b/main_app/migrations/0008_auto_20210416_1718.py @@ -0,0 +1,18 @@ +# Generated by Django 3.1.7 on 2021-04-16 11:48 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('main_app', '0007_auto_20210416_1710'), + ] + + operations = [ + migrations.AlterField( + model_name='register_table', + name='profile_pic', + field=models.ImageField(blank=True, null=True, upload_to='profiles/'), + ), + ] diff --git a/main_app/migrations/0009_remove_register_table_profile_pic.py b/main_app/migrations/0009_remove_register_table_profile_pic.py new file mode 100644 index 00000000..4b9f5cad --- /dev/null +++ b/main_app/migrations/0009_remove_register_table_profile_pic.py @@ -0,0 +1,17 @@ +# Generated by Django 3.0.6 on 2021-04-16 14:50 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('main_app', '0008_auto_20210416_1718'), + ] + + operations = [ + migrations.RemoveField( + model_name='register_table', + name='profile_pic', + ), + ] diff --git a/main_app/models.py b/main_app/models.py index b7ebf32b..7c32f2f7 100644 --- a/main_app/models.py +++ b/main_app/models.py @@ -35,3 +35,15 @@ class Login(models.Model): Username_or_Email= models.CharField(max_length=100) password = models.CharField(max_length=32) + +class register_table(models.Model): + user = models.OneToOneField(User,on_delete=models.CASCADE) + contact_number = models.IntegerField() + age = models.CharField(max_length=250,null=True,blank=True) + city = models.CharField(max_length=250,null=True,blank=True) + gender = models.CharField(max_length=250,default="Male") + added_on =models.DateTimeField(auto_now_add=True,null=True) + update_on = models.DateTimeField(auto_now=True,null=True) + + def __str__(self): + return self.user.username \ No newline at end of file diff --git a/main_app/templates/main_app/common.html b/main_app/templates/main_app/common.html index 4b964022..0a4a4f6a 100644 --- a/main_app/templates/main_app/common.html +++ b/main_app/templates/main_app/common.html @@ -298,6 +298,7 @@

   {{user.username}}

aria-labelledby="navbarDropdown2" style="background-color: rgb(6, 17, 31)" > + Update profile Logout diff --git a/main_app/templates/main_app/home.html b/main_app/templates/main_app/home.html index efd21c01..6bb30e89 100644 --- a/main_app/templates/main_app/home.html +++ b/main_app/templates/main_app/home.html @@ -261,15 +261,19 @@ style="background-color: rgb(6, 17, 31); padding: None">