diff options
19 files changed, 655 insertions, 8 deletions
@@ -26,9 +26,6 @@ target/ #Database db.sqlite3 -# Django Migration files -migrations/ - #MAC OS specific .DS_Store diff --git a/.sampleenv b/.sampleenv new file mode 100644 index 0000000..5d59561 --- /dev/null +++ b/.sampleenv @@ -0,0 +1,7 @@ +# Django settings +DB_ENGINE=<db_engine> +DB_NAME=<db_workshop> +DB_USER=<db_user> +DB_PASSWORD=<db_password> +DB_HOST=<db_host> +DB_PORT=<db_port> diff --git a/requirements.txt b/requirements.txt index b020c4f..622c429 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,5 @@ Django==3.0.7 coverage pyaml +django-recurrence +python-decouple==3.3
\ No newline at end of file diff --git a/workshop_app/migrations/0001_initial.py b/workshop_app/migrations/0001_initial.py new file mode 100644 index 0000000..1fb4dc7 --- /dev/null +++ b/workshop_app/migrations/0001_initial.py @@ -0,0 +1,118 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9 on 2017-06-22 11:03 +from __future__ import unicode_literals + +from django.conf import settings +import django.core.validators +from django.db import migrations, models +import django.db.models.deletion +import recurrence.fields +import workshop_app.models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ] + + operations = [ + migrations.CreateModel( + name='BookedWorkshop', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ], + ), + migrations.CreateModel( + name='Profile', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('institute', models.CharField(max_length=150)), + ('department', models.CharField(choices=[('computer', 'Computer Science'), ('information technology', 'Information Technology'), ('civil engineering', 'Civil Engineering'), ('electrical engineering', 'Electrical Engineering'), ('mechanical engineering', 'Mechanical Engineering'), ('chemical engineering', 'Chemical Engineering'), ('aerospace engineering', 'Aerospace Engineering'), ('biosciences and bioengineering', 'Biosciences and BioEngineering'), ('electronics', 'Electronics'), ('energy science and engineering', 'Energy Science and Engineering'), ('others', 'Others')], max_length=150)), + ('phone_number', models.CharField(max_length=15, validators=[django.core.validators.RegexValidator(message="Phone number must be entered in the format: '+99999999'. Up to 15 digits allowed.", regex='^.{9}$')])), + ('position', models.CharField(choices=[('coordinator', 'Coordinator'), ('instructor', 'Instructor')], default='coordinator', help_text='Select Coordinator if you want to organise a workshop in your college/school. <br> Select Instructor if you want to conduct a workshop.', max_length=32)), + ('is_email_verified', models.BooleanField(default=False)), + ('activation_key', models.CharField(blank=True, max_length=255, null=True)), + ('key_expiry_time', models.DateTimeField(blank=True, null=True)), + ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), + ], + ), + migrations.CreateModel( + name='ProposeWorkshopDate', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('condition_one', models.BooleanField(default=False, help_text='We assure to give minimum 50 participants for the workshop.')), + ('condition_two', models.BooleanField(default=False, help_text="We agree that this booking won't be cancelled without 2days of prior notice to the instructor and fossee.")), + ('condition_three', models.BooleanField(default=False, help_text='This proposal is subject to FOSSEE and instructor approval.')), + ('proposed_workshop_date', models.DateField()), + ('status', models.CharField(default='Pending', max_length=32)), + ('proposed_workshop_coordinator', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), + ('proposed_workshop_instructor', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='workshop_app_proposeworkshopdate_related', to=settings.AUTH_USER_MODEL)), + ], + ), + migrations.CreateModel( + name='RequestedWorkshop', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('requested_workshop_date', models.DateField()), + ('status', models.CharField(default='Pending', max_length=32)), + ('requested_workshop_coordinator', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='workshop_app_requestedworkshop_related', to=settings.AUTH_USER_MODEL)), + ('requested_workshop_instructor', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), + ], + ), + migrations.CreateModel( + name='Testimonial', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=150)), + ('institute', models.CharField(max_length=255)), + ('department', models.CharField(max_length=150)), + ('message', models.TextField()), + ], + ), + migrations.CreateModel( + name='Workshop', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('recurrences', recurrence.fields.RecurrenceField()), + ('workshop_instructor', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), + ], + ), + migrations.CreateModel( + name='WorkshopType', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('workshoptype_name', models.CharField(max_length=120)), + ('workshoptype_description', models.TextField()), + ('workshoptype_duration', models.CharField(help_text='Please write this in following format eg: 3days, 8hours a day', max_length=32)), + ('workshoptype_attachments', models.FileField(blank=True, help_text='Please upload workshop documents one by one, ie.workshop schedule, instructions etc. Please Note: Name of Schedule file should be similar to WorkshopType Name', upload_to=workshop_app.models.attachments)), + ], + ), + migrations.AddField( + model_name='workshop', + name='workshop_title', + field=models.ForeignKey(help_text=' [Select the type of workshop.] ', on_delete=django.db.models.deletion.CASCADE, to='workshop_app.WorkshopType'), + ), + migrations.AddField( + model_name='requestedworkshop', + name='requested_workshop_title', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='workshop_app.WorkshopType'), + ), + migrations.AddField( + model_name='proposeworkshopdate', + name='proposed_workshop_title', + field=models.ForeignKey(help_text='Select the type of workshop.', on_delete=django.db.models.deletion.CASCADE, to='workshop_app.WorkshopType'), + ), + migrations.AddField( + model_name='bookedworkshop', + name='booked_workshop_proposed', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='workshop_app.ProposeWorkshopDate'), + ), + migrations.AddField( + model_name='bookedworkshop', + name='booked_workshop_requested', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='workshop_app.RequestedWorkshop'), + ), + ] diff --git a/workshop_app/migrations/0002_auto_20170623_1513.py b/workshop_app/migrations/0002_auto_20170623_1513.py new file mode 100644 index 0000000..19b8463 --- /dev/null +++ b/workshop_app/migrations/0002_auto_20170623_1513.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9 on 2017-06-23 09:43 +from __future__ import unicode_literals + +import django.core.validators +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('workshop_app', '0001_initial'), + ] + + operations = [ + migrations.AlterField( + model_name='profile', + name='department', + field=models.CharField(choices=[('computer engineering', 'Computer Science'), ('information technology', 'Information Technology'), ('civil engineering', 'Civil Engineering'), ('electrical engineering', 'Electrical Engineering'), ('mechanical engineering', 'Mechanical Engineering'), ('chemical engineering', 'Chemical Engineering'), ('aerospace engineering', 'Aerospace Engineering'), ('biosciences and bioengineering', 'Biosciences and BioEngineering'), ('electronics', 'Electronics'), ('energy science and engineering', 'Energy Science and Engineering'), ('others', 'Others')], max_length=150), + ), + migrations.AlterField( + model_name='profile', + name='phone_number', + field=models.CharField(max_length=10, validators=[django.core.validators.RegexValidator(message="Phone number must be entered in the format: '9999999999'. Up to 10 digits allowed.", regex='^.{10}$')]), + ), + ] diff --git a/workshop_app/migrations/0003_auto_20170906_1501.py b/workshop_app/migrations/0003_auto_20170906_1501.py new file mode 100644 index 0000000..5b604aa --- /dev/null +++ b/workshop_app/migrations/0003_auto_20170906_1501.py @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9 on 2017-09-06 09:31 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('workshop_app', '0002_auto_20170623_1513'), + ] + + operations = [ + migrations.AddField( + model_name='profile', + name='location', + field=models.CharField(blank=True, help_text='Place/City', max_length=255), + ), + migrations.AddField( + model_name='profile', + name='source', + field=models.CharField(blank=True, choices=[('FOSSEE Email', 'FOSSEE Email'), ('FOSSEE website', 'FOSSEE website'), ('Google', 'Google'), ('Social Media', 'Social Media'), ('From other College', 'From other College'), ('Others', 'Others')], max_length=255), + ), + migrations.AddField( + model_name='profile', + name='title', + field=models.CharField(blank=True, choices=[('Professor', 'Prof.'), ('Doctor', 'Dr.'), ('Shriman', 'Shri'), ('Shrimati', 'Smt'), ('Kumari', 'Ku'), ('Mr', 'Mr.'), ('Mrs', 'Mrs.'), ('Miss', 'Ms.'), ('other', 'Other')], max_length=32), + ), + ] diff --git a/workshop_app/migrations/0004_auto_20170914_1528.py b/workshop_app/migrations/0004_auto_20170914_1528.py new file mode 100644 index 0000000..5f40a71 --- /dev/null +++ b/workshop_app/migrations/0004_auto_20170914_1528.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9 on 2017-09-14 09:58 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('workshop_app', '0003_auto_20170906_1501'), + ] + + operations = [ + migrations.AddField( + model_name='profile', + name='state', + field=models.CharField(choices=[('IN-AP', 'Andhra Pradesh'), ('IN-AR', 'Arunachal Pradesh'), ('IN-AS', 'Assam'), ('IN-BR', 'Bihar'), ('IN-CT', 'Chhattisgarh'), ('IN-GA', 'Goa'), ('IN-GJ', 'Gujarat'), ('IN-HR', 'Haryana'), ('IN-HP', 'Himachal Pradesh'), ('IN-JK', 'Jammu and Kashmir'), ('IN-JH', 'Jharkhand'), ('IN-KA', 'Karnataka'), ('IN-KL', 'Kerala'), ('IN-MP', 'Madhya Pradesh'), ('IN-MH', 'Maharashtra'), ('IN-MN', 'Manipur'), ('IN-ML', 'Meghalaya'), ('IN-MZ', 'Mizoram'), ('IN-NL', 'Nagaland'), ('IN-OR', 'Odisha'), ('IN-PB', 'Punjab'), ('IN-RJ', 'Rajasthan'), ('IN-SK', 'Sikkim'), ('IN-TN', 'Tamil Nadu'), ('IN-TG', 'Telangana'), ('IN-TR', 'Tripura'), ('IN-UT', 'Uttarakhand'), ('IN-UP', 'Uttar Pradesh'), ('IN-WB', 'West Bengal'), ('IN-AN', 'Andaman and Nicobar Islands'), ('IN-CH', 'Chandigarh'), ('IN-DN', 'Dadra and Nagar Haveli'), ('IN-DD', 'Daman and Diu'), ('IN-DL', 'Delhi'), ('IN-LD', 'Lakshadweep'), ('IN-PY', 'Puducherry')], default='IN-MH', max_length=255), + ), + migrations.AlterField( + model_name='profile', + name='position', + field=models.CharField(choices=[('coordinator', 'Coordinator'), ('instructor', 'Instructor')], default='coordinator', help_text='Select Coordinator if you want to organise a workshop in your college/school. <br> Select Instructor if you want to conduct a workshop.', max_length=32), + ), + ] diff --git a/workshop_app/migrations/0005_auto_20170920_1720.py b/workshop_app/migrations/0005_auto_20170920_1720.py new file mode 100644 index 0000000..70ca9cc --- /dev/null +++ b/workshop_app/migrations/0005_auto_20170920_1720.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9 on 2017-09-20 11:50 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('workshop_app', '0004_auto_20170914_1528'), + ] + + operations = [ + migrations.RenameField( + model_name='profile', + old_name='source', + new_name='how_did_you_hear_about_us', + ), + ] diff --git a/workshop_app/migrations/0006_auto_20180312_1056.py b/workshop_app/migrations/0006_auto_20180312_1056.py new file mode 100644 index 0000000..aa995ef --- /dev/null +++ b/workshop_app/migrations/0006_auto_20180312_1056.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9 on 2018-03-12 05:26 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('workshop_app', '0005_auto_20170920_1720'), + ] + + operations = [ + migrations.AlterField( + model_name='profile', + name='how_did_you_hear_about_us', + field=models.CharField(blank=True, choices=[('FOSSEE fellowship', 'FOSSEE fellowship'), ('FOSSEE Email', 'FOSSEE Email'), ('FOSSEE website', 'FOSSEE website'), ('Google', 'Google'), ('Social Media', 'Social Media'), ('From other College', 'From other College'), ('Others', 'Others')], max_length=255), + ), + ] diff --git a/workshop_app/migrations/0007_auto_20180510_1635.py b/workshop_app/migrations/0007_auto_20180510_1635.py new file mode 100644 index 0000000..0fb0d6f --- /dev/null +++ b/workshop_app/migrations/0007_auto_20180510_1635.py @@ -0,0 +1,35 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9 on 2018-05-10 11:05 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('workshop_app', '0006_auto_20180312_1056'), + ] + + operations = [ + migrations.AlterField( + model_name='profile', + name='how_did_you_hear_about_us', + field=models.CharField(blank=True, choices=[('FOSSEE Email', 'FOSSEE Email'), ('FOSSEE website', 'FOSSEE website'), ('Google', 'Google'), ('Social Media', 'Social Media'), ('From other College', 'From other College'), ('Others', 'Others')], max_length=255), + ), + migrations.AlterField( + model_name='profile', + name='position', + field=models.CharField(choices=[('coordinator', 'Coordinator'), ('instructor', 'Instructor')], default='coordinator', help_text='Select Coordinator if you want to organise a workshop in your college/school. <br> Select Instructor if you want to conduct a workshop.', max_length=32), + ), + migrations.AlterField( + model_name='proposeworkshopdate', + name='condition_one', + field=models.BooleanField(default=False, help_text='We assure to give minimum 30 participants for the workshop.'), + ), + migrations.AlterField( + model_name='proposeworkshopdate', + name='condition_two', + field=models.BooleanField(default=False, help_text="We agree that this booking won't be cancelled without 2days of prior notice to the instructor and fossee."), + ), + ] diff --git a/workshop_app/migrations/0008_auto_20180514_1655.py b/workshop_app/migrations/0008_auto_20180514_1655.py new file mode 100644 index 0000000..325fb25 --- /dev/null +++ b/workshop_app/migrations/0008_auto_20180514_1655.py @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9 on 2018-05-14 11:25 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('workshop_app', '0007_auto_20180510_1635'), + ] + + operations = [ + migrations.AlterField( + model_name='profile', + name='department', + field=models.CharField(choices=[('computer engineering', 'Computer Science'), ('information technology', 'Information Technology'), ('civil engineering', 'Civil Engineering'), ('electrical engineering', 'Electrical Engineering'), ('mechanical engineering', 'Mechanical Engineering'), ('chemical engineering', 'Chemical Engineering'), ('aerospace engineering', 'Aerospace Engineering'), ('biosciences and bioengineering', 'Biosciences and BioEngineering'), ('electronics', 'Electronics'), ('energy science and engineering', 'Energy Science and Engineering')], max_length=150), + ), + migrations.AlterField( + model_name='profile', + name='how_did_you_hear_about_us', + field=models.CharField(blank=True, choices=[('FOSSEE website', 'FOSSEE website'), ('Google', 'Google'), ('Social Media', 'Social Media'), ('From other College', 'From other College')], max_length=255), + ), + migrations.AlterField( + model_name='profile', + name='title', + field=models.CharField(blank=True, choices=[('Professor', 'Prof.'), ('Doctor', 'Dr.'), ('Shriman', 'Shri'), ('Shrimati', 'Smt'), ('Kumari', 'Ku'), ('Mr', 'Mr.'), ('Mrs', 'Mrs.'), ('Miss', 'Ms.')], max_length=32), + ), + ] diff --git a/workshop_app/migrations/0009_profilecomments.py b/workshop_app/migrations/0009_profilecomments.py new file mode 100644 index 0000000..0852d7c --- /dev/null +++ b/workshop_app/migrations/0009_profilecomments.py @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9 on 2018-08-03 11:06 +from __future__ import unicode_literals + +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion +import django.utils.timezone + + +class Migration(migrations.Migration): + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ('workshop_app', '0008_auto_20180514_1655'), + ] + + operations = [ + migrations.CreateModel( + name='ProfileComments', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('comment', models.TextField()), + ('created_date', models.DateTimeField(default=django.utils.timezone.now)), + ('coordinator_profile', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), + ('instructor_profile', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='workshop_app_profilecomments_related', to=settings.AUTH_USER_MODEL)), + ], + ), + ] diff --git a/workshop_app/migrations/0010_auto_20190926_1558.py b/workshop_app/migrations/0010_auto_20190926_1558.py new file mode 100644 index 0000000..0e15caa --- /dev/null +++ b/workshop_app/migrations/0010_auto_20190926_1558.py @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9 on 2019-09-26 10:28 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('workshop_app', '0009_profilecomments'), + ] + + operations = [ + migrations.CreateModel( + name='Banner', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('title', models.CharField(max_length=500)), + ('html', models.TextField()), + ('active', models.BooleanField()), + ], + ), + migrations.AlterField( + model_name='proposeworkshopdate', + name='condition_one', + field=models.BooleanField(default=False, help_text='We assure to give minimum 25 participants for the workshop.'), + ), + ] diff --git a/workshop_app/migrations/0011_auto_20200727_2313.py b/workshop_app/migrations/0011_auto_20200727_2313.py new file mode 100644 index 0000000..3645a95 --- /dev/null +++ b/workshop_app/migrations/0011_auto_20200727_2313.py @@ -0,0 +1,166 @@ +# Generated by Django 3.0.7 on 2020-07-27 17:43 + +from django.conf import settings +import django.core.validators +from django.db import migrations, models +import django.db.models.deletion +import django.utils.timezone +import workshop_app.models + + +class Migration(migrations.Migration): + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ('workshop_app', '0010_auto_20190926_1558'), + ] + + operations = [ + migrations.CreateModel( + name='AttachmentFile', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('attachments', models.FileField(help_text='Please upload workshop documents one by one, ie.workshop schedule, instructions etc. Please Note: Name of Schedule file should be similar to WorkshopType Name', upload_to=workshop_app.models.attachments)), + ], + ), + migrations.CreateModel( + name='Comment', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('comment', models.TextField()), + ('public', models.BooleanField(default=True)), + ('created_date', models.DateTimeField(default=django.utils.timezone.now)), + ('author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), + ], + ), + migrations.RemoveField( + model_name='profilecomments', + name='coordinator_profile', + ), + migrations.RemoveField( + model_name='profilecomments', + name='instructor_profile', + ), + migrations.RemoveField( + model_name='proposeworkshopdate', + name='proposed_workshop_coordinator', + ), + migrations.RemoveField( + model_name='proposeworkshopdate', + name='proposed_workshop_instructor', + ), + migrations.RemoveField( + model_name='proposeworkshopdate', + name='proposed_workshop_title', + ), + migrations.RemoveField( + model_name='requestedworkshop', + name='requested_workshop_coordinator', + ), + migrations.RemoveField( + model_name='requestedworkshop', + name='requested_workshop_instructor', + ), + migrations.RemoveField( + model_name='requestedworkshop', + name='requested_workshop_title', + ), + migrations.RenameField( + model_name='workshop', + old_name='workshop_instructor', + new_name='coordinator', + ), + migrations.RenameField( + model_name='workshoptype', + old_name='workshoptype_description', + new_name='description', + ), + migrations.RenameField( + model_name='workshoptype', + old_name='workshoptype_name', + new_name='name', + ), + migrations.RemoveField( + model_name='workshop', + name='recurrences', + ), + migrations.RemoveField( + model_name='workshop', + name='workshop_title', + ), + migrations.RemoveField( + model_name='workshoptype', + name='workshoptype_attachments', + ), + migrations.RemoveField( + model_name='workshoptype', + name='workshoptype_duration', + ), + migrations.AddField( + model_name='workshop', + name='date', + field=models.DateField(default=django.utils.timezone.now), + preserve_default=False, + ), + migrations.AddField( + model_name='workshop', + name='instructor', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='workshop_app_workshop_related', to=settings.AUTH_USER_MODEL), + ), + migrations.AddField( + model_name='workshop', + name='status', + field=models.IntegerField(choices=[(0, 'Pending'), (1, 'Accepted'), (2, 'Deleted')], default=0), + ), + migrations.AddField( + model_name='workshop', + name='tnc_accepted', + field=models.BooleanField(default=False, help_text='I accept the terms and conditions'), + preserve_default=False, + ), + migrations.AddField( + model_name='workshop', + name='workshop_type', + field=models.ForeignKey(default=1, help_text='Select the type of workshop.', on_delete=django.db.models.deletion.CASCADE, to='workshop_app.WorkshopType'), + preserve_default=False, + ), + migrations.AddField( + model_name='workshoptype', + name='duration', + field=models.PositiveIntegerField(default=1, help_text='Please enter duration in days', validators=[django.core.validators.MinValueValidator(1)]), + preserve_default=False, + ), + migrations.AddField( + model_name='workshoptype', + name='terms_and_conditions', + field=models.TextField(default=True), + preserve_default=False, + ), + migrations.AlterField( + model_name='profile', + name='phone_number', + field=models.CharField(max_length=10, validators=[django.core.validators.RegexValidator(message="Phone number must be entered in the format: '9999999999'. Up to 10 digits allowed.", regex='^.{10}$')]), + ), + migrations.DeleteModel( + name='BookedWorkshop', + ), + migrations.DeleteModel( + name='ProfileComments', + ), + migrations.DeleteModel( + name='ProposeWorkshopDate', + ), + migrations.DeleteModel( + name='RequestedWorkshop', + ), + migrations.AddField( + model_name='comment', + name='workshop', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='workshop_app.Workshop'), + ), + migrations.AddField( + model_name='attachmentfile', + name='workshop_type', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='workshop_app.WorkshopType'), + ), + ] diff --git a/workshop_app/migrations/0012_auto_20200727_2315.py b/workshop_app/migrations/0012_auto_20200727_2315.py new file mode 100644 index 0000000..35ab979 --- /dev/null +++ b/workshop_app/migrations/0012_auto_20200727_2315.py @@ -0,0 +1,46 @@ +# Generated by Django 3.0.7 on 2020-07-27 17:45 + +import os +import json +from django.db import migrations + + +def load_data(apps, schema_editor): + Workshop = apps.get_model("workshop_app", "Workshop") + cur_dir = os.path.dirname(os.path.abspath(__file__)) + db_json = os.path.join(cur_dir, 'db.json') + if os.path.exists(db_json): + with open(db_json, encoding='utf-8') as file: + workshops = json.load(file) + for workshop in workshops: + if workshop['model'] == 'workshop_app.proposeworkshopdate': + _id = workshop['pk'] + coordinator_id = workshop['fields']['proposed_workshop_coordinator'] + date = workshop['fields']['proposed_workshop_date'] + instructor_id = workshop['fields']['proposed_workshop_instructor'] + status = 1 + tnc_accepted = True + workshop_type_id = workshop['fields']['proposed_workshop_title'] + Workshop.objects.create(coordinator_id=coordinator_id, + date=date, instructor_id=instructor_id, status=status, + tnc_accepted=tnc_accepted, + workshop_type_id=workshop_type_id + ) + + +def reverse_load_data(apps, schema_editor): + Workshop = apps.get_model("workshop_app", "Workshop") + Workshop.objects.filter( + id__in=list(Workshop.objects.values_list('pk', flat=True)[16:]) + ).delete() + + +class Migration(migrations.Migration): + + dependencies = [ + ('workshop_app', '0011_auto_20200727_2313'), + ] + + operations = [ + migrations.RunPython(load_data, reverse_load_data), + ] diff --git a/workshop_app/migrations/0013_workshop_uid.py b/workshop_app/migrations/0013_workshop_uid.py new file mode 100644 index 0000000..254073f --- /dev/null +++ b/workshop_app/migrations/0013_workshop_uid.py @@ -0,0 +1,19 @@ +# Generated by Django 3.0.7 on 2020-07-27 18:03 + +from django.db import migrations, models +import uuid + + +class Migration(migrations.Migration): + + dependencies = [ + ('workshop_app', '0012_auto_20200727_2315'), + ] + + operations = [ + migrations.AddField( + model_name='workshop', + name='uid', + field=models.UUIDField(default=uuid.uuid4, editable=False, null=True), + ), + ] diff --git a/workshop_app/migrations/0014_auto_20200727_2334.py b/workshop_app/migrations/0014_auto_20200727_2334.py new file mode 100644 index 0000000..ec704d5 --- /dev/null +++ b/workshop_app/migrations/0014_auto_20200727_2334.py @@ -0,0 +1,24 @@ +# Generated by Django 3.0.7 on 2020-07-27 18:04 + +from django.db import migrations +import uuid + + +def create_uuid(apps, schema_editor): + Workshop = apps.get_model('workshop_app', 'Workshop') + for workshop in Workshop.objects.all(): + workshop.uid = uuid.uuid4() + workshop.save(update_fields=['uid']) + + +class Migration(migrations.Migration): + + dependencies = [ + ('workshop_app', '0013_workshop_uid'), + ] + + operations = [ + migrations.RunPython( + create_uuid, reverse_code=migrations.RunPython.noop + ), + ] diff --git a/workshop_app/migrations/0015_auto_20200727_2334.py b/workshop_app/migrations/0015_auto_20200727_2334.py new file mode 100644 index 0000000..4958a41 --- /dev/null +++ b/workshop_app/migrations/0015_auto_20200727_2334.py @@ -0,0 +1,19 @@ +# Generated by Django 3.0.7 on 2020-07-27 18:04 + +from django.db import migrations, models +import uuid + + +class Migration(migrations.Migration): + + dependencies = [ + ('workshop_app', '0014_auto_20200727_2334'), + ] + + operations = [ + migrations.AlterField( + model_name='workshop', + name='uid', + field=models.UUIDField(default=uuid.uuid4, editable=False, unique=True), + ), + ] diff --git a/workshop_portal/settings.py b/workshop_portal/settings.py index b340ab2..78f0358 100644 --- a/workshop_portal/settings.py +++ b/workshop_portal/settings.py @@ -21,6 +21,8 @@ from local_settings import ( SENDER_EMAIL ) +from decouple import config + # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) @@ -83,11 +85,14 @@ WSGI_APPLICATION = 'workshop_portal.wsgi.application' # https://docs.djangoproject.com/en/1.10/ref/settings/#databases DATABASES = { 'default': { - 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), - 'TEST': { - 'NAME': 'mytestdatabase', - }, + 'ENGINE': 'django.db.backends.{0}'.format( + config('DB_ENGINE', default='sqlite3') + ), + 'NAME': config('DB_NAME', default=os.path.join(BASE_DIR, 'db.sqlite3')), + 'USER': config('DB_USER', default=''), + 'PASSWORD': config('DB_PASSWORD', default=''), + 'HOST': config('DB_HOST', default='localhost'), + 'PORT': config('DB_PORT', default='') } } |