diff --git a/requirements/dev.txt b/requirements/dev.txt index 997e4b27..40e73ff0 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -10,6 +10,6 @@ pytest-cov==2.5.1 pytest-django==3.2.1 pytest-pylint==0.9.0 selenium==3.12.0 -djangorestframework==3.8.2 +djangorestframework==3.11.0 geopy==1.15.0 -pinax-notifications==5.0.3 +pinax-notifications==6.0.0 diff --git a/requirements/prod.txt b/requirements/prod.txt index 36e36d25..7ff91174 100644 --- a/requirements/prod.txt +++ b/requirements/prod.txt @@ -1,11 +1,11 @@ -Django==1.11.29 -Pillow==4.3.0 -django-allauth==0.33.0 -django-braces==1.11.0 -django-cities-light==3.3.0 -django-ckeditor==5.3.1 -django-crispy-forms==1.7.0 -django-guardian==1.4.9 +Django==3.0.8 +Pillow==7.2.0 +django-allauth==0.42.0 +django-braces==1.14.0 +django-cities-light==3.6.0 +django-ckeditor==5.9.0 +django-crispy-forms==1.9.2 +django-guardian==2.3.0 django-imagekit==4.0.1 psycopg2==2.7.3.2 python3-openid==3.1.0 diff --git a/systers_portal/blog/migrations/0001_initial.py b/systers_portal/blog/migrations/0001_initial.py index f63c42bc..19ebca09 100644 --- a/systers_portal/blog/migrations/0001_initial.py +++ b/systers_portal/blog/migrations/0001_initial.py @@ -1,91 +1,58 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals +# Generated by Django 2.0 on 2020-07-08 16:09 -from django.db import models, migrations +import ckeditor.fields +from django.db import migrations, models class Migration(migrations.Migration): + initial = True + dependencies = [ - ('community', '0001_initial'), - ('users', '0001_squashed_0003_auto_20160207_1550'), ] operations = [ migrations.CreateModel( name='News', fields=[ - ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('slug', models.SlugField(unique=True, max_length=150, verbose_name=b'Slug')), - ('title', models.CharField(max_length=255, verbose_name=b'Title')), - ('date_created', models.DateField(auto_now_add=True, verbose_name=b'Date published')), - ('date_modified', models.DateField(auto_now=True, verbose_name=b'Date last modified')), - ('content', models.TextField(verbose_name=b'Content')), - ('is_public', models.BooleanField(default=True, verbose_name=b'Is public')), - ('is_monitored', models.BooleanField(default=False, verbose_name=b'Is monitored')), - ('author', models.ForeignKey(verbose_name=b'Author', to='users.SystersUser')), - ('community', models.ForeignKey(verbose_name=b'Community', to='community.Community')), + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('slug', models.SlugField(max_length=150, verbose_name='Slug')), + ('title', models.CharField(max_length=255, verbose_name='Title')), + ('date_created', models.DateField(auto_now_add=True, verbose_name='Date published')), + ('date_modified', models.DateField(auto_now=True, verbose_name='Date last modified')), + ('content', ckeditor.fields.RichTextField(verbose_name='Content')), + ('is_public', models.BooleanField(default=True, verbose_name='Is public')), + ('is_monitored', models.BooleanField(default=False, verbose_name='Is monitored')), ], options={ 'verbose_name_plural': 'News', }, - bases=(models.Model,), ), migrations.CreateModel( name='Resource', fields=[ - ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('slug', models.SlugField(unique=True, max_length=150, verbose_name=b'Slug')), - ('title', models.CharField(max_length=255, verbose_name=b'Title')), - ('date_created', models.DateField(auto_now_add=True, verbose_name=b'Date published')), - ('date_modified', models.DateField(auto_now=True, verbose_name=b'Date last modified')), - ('content', models.TextField(verbose_name=b'Content')), - ('is_public', models.BooleanField(default=True, verbose_name=b'Is public')), - ('is_monitored', models.BooleanField(default=False, verbose_name=b'Is monitored')), - ('author', models.ForeignKey(verbose_name=b'Author', to='users.SystersUser')), - ('community', models.ForeignKey(verbose_name=b'Community', to='community.Community')), + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('slug', models.SlugField(max_length=150, verbose_name='Slug')), + ('title', models.CharField(max_length=255, verbose_name='Title')), + ('date_created', models.DateField(auto_now_add=True, verbose_name='Date published')), + ('date_modified', models.DateField(auto_now=True, verbose_name='Date last modified')), + ('content', ckeditor.fields.RichTextField(verbose_name='Content')), + ('is_public', models.BooleanField(default=True, verbose_name='Is public')), + ('is_monitored', models.BooleanField(default=False, verbose_name='Is monitored')), ], - options={ - 'abstract': False, - }, - bases=(models.Model,), ), migrations.CreateModel( name='ResourceType', fields=[ - ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('name', models.CharField(max_length=255)), + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=255, unique=True)), ], - options={ - }, - bases=(models.Model,), ), migrations.CreateModel( name='Tag', fields=[ - ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('name', models.CharField(max_length=255)), + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=255, unique=True)), ], - options={ - }, - bases=(models.Model,), - ), - migrations.AddField( - model_name='resource', - name='resource_type', - field=models.ForeignKey(verbose_name=b'Resource type', blank=True, to='blog.ResourceType', null=True), - preserve_default=True, - ), - migrations.AddField( - model_name='resource', - name='tags', - field=models.ManyToManyField(to='blog.Tag', null=True, verbose_name=b'Tags', blank=True), - preserve_default=True, - ), - migrations.AddField( - model_name='news', - name='tags', - field=models.ManyToManyField(to='blog.Tag', null=True, verbose_name=b'Tags', blank=True), - preserve_default=True, ), ] diff --git a/systers_portal/blog/migrations/0002_auto_20140928_2034.py b/systers_portal/blog/migrations/0002_auto_20140928_2034.py deleted file mode 100644 index 4d4b485a..00000000 --- a/systers_portal/blog/migrations/0002_auto_20140928_2034.py +++ /dev/null @@ -1,25 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import models, migrations -import ckeditor.fields - - -class Migration(migrations.Migration): - - dependencies = [ - ('blog', '0001_initial'), - ] - - operations = [ - migrations.AlterField( - model_name='news', - name='content', - field=ckeditor.fields.RichTextField(verbose_name=b'Content'), - ), - migrations.AlterField( - model_name='resource', - name='content', - field=ckeditor.fields.RichTextField(verbose_name=b'Content'), - ), - ] diff --git a/systers_portal/blog/migrations/0002_auto_20200708_1609.py b/systers_portal/blog/migrations/0002_auto_20200708_1609.py new file mode 100644 index 00000000..7316fa75 --- /dev/null +++ b/systers_portal/blog/migrations/0002_auto_20200708_1609.py @@ -0,0 +1,61 @@ +# Generated by Django 2.0 on 2020-07-08 16:09 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ('blog', '0001_initial'), + ('users', '0001_initial'), + ('community', '0001_initial'), + ] + + operations = [ + migrations.AddField( + model_name='resource', + name='author', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='users.SystersUser', verbose_name='Author'), + ), + migrations.AddField( + model_name='resource', + name='community', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='community.Community', verbose_name='Community'), + ), + migrations.AddField( + model_name='resource', + name='resource_type', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='blog.ResourceType', verbose_name='Resource type'), + ), + migrations.AddField( + model_name='resource', + name='tags', + field=models.ManyToManyField(blank=True, to='blog.Tag', verbose_name='Tags'), + ), + migrations.AddField( + model_name='news', + name='author', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='users.SystersUser', verbose_name='Author'), + ), + migrations.AddField( + model_name='news', + name='community', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='community.Community', verbose_name='Community'), + ), + migrations.AddField( + model_name='news', + name='tags', + field=models.ManyToManyField(blank=True, to='blog.Tag', verbose_name='Tags'), + ), + migrations.AlterUniqueTogether( + name='resource', + unique_together={('community', 'slug')}, + ), + migrations.AlterUniqueTogether( + name='news', + unique_together={('community', 'slug')}, + ), + ] diff --git a/systers_portal/blog/migrations/0003_auto_20150303_0501.py b/systers_portal/blog/migrations/0003_auto_20150303_0501.py deleted file mode 100644 index bb662b19..00000000 --- a/systers_portal/blog/migrations/0003_auto_20150303_0501.py +++ /dev/null @@ -1,26 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import models, migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('blog', '0002_auto_20140928_2034'), - ] - - operations = [ - migrations.AlterField( - model_name='resourcetype', - name='name', - field=models.CharField(unique=True, max_length=255), - preserve_default=True, - ), - migrations.AlterField( - model_name='tag', - name='name', - field=models.CharField(unique=True, max_length=255), - preserve_default=True, - ), - ] diff --git a/systers_portal/blog/migrations/0004_auto_20150420_1504.py b/systers_portal/blog/migrations/0004_auto_20150420_1504.py deleted file mode 100644 index 8fe0c8d2..00000000 --- a/systers_portal/blog/migrations/0004_auto_20150420_1504.py +++ /dev/null @@ -1,141 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import models, migrations -import ckeditor.fields - - -class Migration(migrations.Migration): - - dependencies = [ - ('blog', '0003_auto_20150303_0501'), - ] - - operations = [ - migrations.AlterField( - model_name='news', - name='author', - field=models.ForeignKey(verbose_name='Author', to='users.SystersUser'), - preserve_default=True, - ), - migrations.AlterField( - model_name='news', - name='community', - field=models.ForeignKey(verbose_name='Community', to='community.Community'), - preserve_default=True, - ), - migrations.AlterField( - model_name='news', - name='content', - field=ckeditor.fields.RichTextField(verbose_name='Content'), - preserve_default=True, - ), - migrations.AlterField( - model_name='news', - name='date_created', - field=models.DateField(auto_now_add=True, verbose_name='Date published'), - preserve_default=True, - ), - migrations.AlterField( - model_name='news', - name='date_modified', - field=models.DateField(auto_now=True, verbose_name='Date last modified'), - preserve_default=True, - ), - migrations.AlterField( - model_name='news', - name='is_monitored', - field=models.BooleanField(verbose_name='Is monitored', default=False), - preserve_default=True, - ), - migrations.AlterField( - model_name='news', - name='is_public', - field=models.BooleanField(verbose_name='Is public', default=True), - preserve_default=True, - ), - migrations.AlterField( - model_name='news', - name='slug', - field=models.SlugField(verbose_name='Slug', max_length=150), - preserve_default=True, - ), - migrations.AlterField( - model_name='news', - name='tags', - field=models.ManyToManyField(null=True, blank=True, verbose_name='Tags', to='blog.Tag'), - preserve_default=True, - ), - migrations.AlterField( - model_name='news', - name='title', - field=models.CharField(verbose_name='Title', max_length=255), - preserve_default=True, - ), - migrations.AlterField( - model_name='resource', - name='author', - field=models.ForeignKey(verbose_name='Author', to='users.SystersUser'), - preserve_default=True, - ), - migrations.AlterField( - model_name='resource', - name='community', - field=models.ForeignKey(verbose_name='Community', to='community.Community'), - preserve_default=True, - ), - migrations.AlterField( - model_name='resource', - name='content', - field=ckeditor.fields.RichTextField(verbose_name='Content'), - preserve_default=True, - ), - migrations.AlterField( - model_name='resource', - name='date_created', - field=models.DateField(auto_now_add=True, verbose_name='Date published'), - preserve_default=True, - ), - migrations.AlterField( - model_name='resource', - name='date_modified', - field=models.DateField(auto_now=True, verbose_name='Date last modified'), - preserve_default=True, - ), - migrations.AlterField( - model_name='resource', - name='is_monitored', - field=models.BooleanField(verbose_name='Is monitored', default=False), - preserve_default=True, - ), - migrations.AlterField( - model_name='resource', - name='is_public', - field=models.BooleanField(verbose_name='Is public', default=True), - preserve_default=True, - ), - migrations.AlterField( - model_name='resource', - name='resource_type', - field=models.ForeignKey(blank=True, verbose_name='Resource type', to='blog.ResourceType', null=True), - preserve_default=True, - ), - migrations.AlterField( - model_name='resource', - name='slug', - field=models.SlugField(verbose_name='Slug', max_length=150), - preserve_default=True, - ), - migrations.AlterField( - model_name='resource', - name='tags', - field=models.ManyToManyField(null=True, blank=True, verbose_name='Tags', to='blog.Tag'), - preserve_default=True, - ), - migrations.AlterField( - model_name='resource', - name='title', - field=models.CharField(verbose_name='Title', max_length=255), - preserve_default=True, - ), - ] diff --git a/systers_portal/blog/migrations/0005_auto_20150522_1138.py b/systers_portal/blog/migrations/0005_auto_20150522_1138.py deleted file mode 100644 index b9fda0d0..00000000 --- a/systers_portal/blog/migrations/0005_auto_20150522_1138.py +++ /dev/null @@ -1,22 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import models, migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('blog', '0004_auto_20150420_1504'), - ] - - operations = [ - migrations.AlterUniqueTogether( - name='news', - unique_together=set([('community', 'slug')]), - ), - migrations.AlterUniqueTogether( - name='resource', - unique_together=set([('community', 'slug')]), - ), - ] diff --git a/systers_portal/blog/migrations/0006_auto_20150522_1233.py b/systers_portal/blog/migrations/0006_auto_20150522_1233.py deleted file mode 100644 index d4686545..00000000 --- a/systers_portal/blog/migrations/0006_auto_20150522_1233.py +++ /dev/null @@ -1,24 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import models, migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('blog', '0005_auto_20150522_1138'), - ] - - operations = [ - migrations.AlterField( - model_name='news', - name='tags', - field=models.ManyToManyField(blank=True, to='blog.Tag', verbose_name='Tags'), - ), - migrations.AlterField( - model_name='resource', - name='tags', - field=models.ManyToManyField(blank=True, to='blog.Tag', verbose_name='Tags'), - ), - ] diff --git a/systers_portal/blog/models.py b/systers_portal/blog/models.py index d28e0297..7ec0272b 100644 --- a/systers_portal/blog/models.py +++ b/systers_portal/blog/models.py @@ -1,4 +1,4 @@ -from django.core.urlresolvers import reverse +from django.urls import reverse from django.db import models from common.models import Post @@ -23,7 +23,7 @@ def __str__(self): class News(Post): """Model to represent community news in resource area""" - community = models.ForeignKey(Community, verbose_name="Community") + community = models.ForeignKey(Community, verbose_name="Community", on_delete=models.CASCADE) is_public = models.BooleanField(default=True, verbose_name="Is public") is_monitored = models.BooleanField(default=False, verbose_name="Is monitored") @@ -45,13 +45,13 @@ def get_absolute_url(self): class Resource(Post): """Model to represent community resource in resource area""" - community = models.ForeignKey(Community, verbose_name="Community") + community = models.ForeignKey(Community, verbose_name="Community", on_delete=models.CASCADE) is_public = models.BooleanField(default=True, verbose_name="Is public") is_monitored = models.BooleanField(default=False, verbose_name="Is monitored") tags = models.ManyToManyField(Tag, blank=True, verbose_name="Tags") resource_type = models.ForeignKey(ResourceType, blank=True, null=True, - verbose_name="Resource type") + verbose_name="Resource type", on_delete=models.CASCADE) class Meta: unique_together = ('community', 'slug') diff --git a/systers_portal/blog/tests/test_views.py b/systers_portal/blog/tests/test_views.py index 7d956e0d..ace1d0b1 100644 --- a/systers_portal/blog/tests/test_views.py +++ b/systers_portal/blog/tests/test_views.py @@ -1,6 +1,6 @@ from cities_light.models import Country, City from django.contrib.auth.models import User, Group -from django.core.urlresolvers import reverse +from django.urls import reverse from django.test import TestCase, Client from blog.models import News, Resource, ResourceType, Tag diff --git a/systers_portal/blog/views.py b/systers_portal/blog/views.py index 2bd03680..4978c90b 100644 --- a/systers_portal/blog/views.py +++ b/systers_portal/blog/views.py @@ -1,4 +1,4 @@ -from django.core.urlresolvers import reverse +from django.urls import reverse from django.shortcuts import get_object_or_404 from django.views.generic import (ListView, DetailView, CreateView, UpdateView, DeleteView) diff --git a/systers_portal/common/migrations/0001_initial.py b/systers_portal/common/migrations/0001_initial.py index b5891d28..6e2ad968 100644 --- a/systers_portal/common/migrations/0001_initial.py +++ b/systers_portal/common/migrations/0001_initial.py @@ -1,30 +1,24 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals +# Generated by Django 2.0 on 2020-07-08 16:09 -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): + initial = True + dependencies = [ - ('users', '0001_squashed_0003_auto_20160207_1550'), - ('contenttypes', '0001_initial'), ] operations = [ migrations.CreateModel( name='Comment', fields=[ - ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('date_created', models.DateField(auto_now_add=True, verbose_name=b'Date created')), - ('is_approved', models.BooleanField(default=True, verbose_name=b'Is approved')), - ('body', models.TextField(verbose_name=b'Body')), + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('date_created', models.DateField(auto_now_add=True, verbose_name='Date created')), + ('is_approved', models.BooleanField(default=True, verbose_name='Is approved')), + ('body', models.TextField(verbose_name='Body')), ('object_id', models.PositiveIntegerField()), - ('author', models.ForeignKey(verbose_name=b'Author', to='users.SystersUser')), - ('content_type', models.ForeignKey(to='contenttypes.ContentType')), ], - options={ - }, - bases=(models.Model,), ), ] diff --git a/systers_portal/common/migrations/0002_auto_20150420_1504.py b/systers_portal/common/migrations/0002_auto_20150420_1504.py deleted file mode 100644 index e58e4984..00000000 --- a/systers_portal/common/migrations/0002_auto_20150420_1504.py +++ /dev/null @@ -1,38 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import models, migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('common', '0001_initial'), - ] - - operations = [ - migrations.AlterField( - model_name='comment', - name='author', - field=models.ForeignKey(verbose_name='Author', to='users.SystersUser'), - preserve_default=True, - ), - migrations.AlterField( - model_name='comment', - name='body', - field=models.TextField(verbose_name='Body'), - preserve_default=True, - ), - migrations.AlterField( - model_name='comment', - name='date_created', - field=models.DateField(auto_now_add=True, verbose_name='Date created'), - preserve_default=True, - ), - migrations.AlterField( - model_name='comment', - name='is_approved', - field=models.BooleanField(verbose_name='Is approved', default=True), - preserve_default=True, - ), - ] diff --git a/systers_portal/common/migrations/0002_auto_20200708_1609.py b/systers_portal/common/migrations/0002_auto_20200708_1609.py new file mode 100644 index 00000000..cbdfe3a2 --- /dev/null +++ b/systers_portal/common/migrations/0002_auto_20200708_1609.py @@ -0,0 +1,28 @@ +# Generated by Django 2.0 on 2020-07-08 16:09 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ('common', '0001_initial'), + ('users', '0001_initial'), + ('contenttypes', '0002_remove_content_type_name'), + ] + + operations = [ + migrations.AddField( + model_name='comment', + name='author', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='users.SystersUser', verbose_name='Author'), + ), + migrations.AddField( + model_name='comment', + name='content_type', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='contenttypes.ContentType'), + ), + ] diff --git a/systers_portal/common/models.py b/systers_portal/common/models.py index b53ea10b..dfb17087 100644 --- a/systers_portal/common/models.py +++ b/systers_portal/common/models.py @@ -16,7 +16,7 @@ class Post(models.Model): verbose_name="Date published") date_modified = models.DateField(auto_now=True, auto_now_add=False, verbose_name="Date last modified") - author = models.ForeignKey(SystersUser, verbose_name="Author") + author = models.ForeignKey(SystersUser, verbose_name="Author", on_delete=models.CASCADE) content = RichTextField(verbose_name="Content") class Meta: @@ -28,10 +28,10 @@ class Comment(models.Model): Intended to be used for News and Resource models.""" date_created = models.DateField(auto_now=False, auto_now_add=True, verbose_name="Date created") - author = models.ForeignKey(SystersUser, verbose_name="Author") + author = models.ForeignKey(SystersUser, verbose_name="Author", on_delete=models.CASCADE) is_approved = models.BooleanField(default=True, verbose_name='Is approved') body = models.TextField(verbose_name="Body") - content_type = models.ForeignKey(ContentType) + content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE) object_id = models.PositiveIntegerField() content_object = GenericForeignKey() diff --git a/systers_portal/common/tests/test_views.py b/systers_portal/common/tests/test_views.py index 8b913a64..26040b69 100644 --- a/systers_portal/common/tests/test_views.py +++ b/systers_portal/common/tests/test_views.py @@ -1,4 +1,4 @@ -from django.core.urlresolvers import reverse +from django.urls import reverse from django.test import TestCase, Client from django.contrib.auth.models import User diff --git a/systers_portal/community/migrations/0001_initial.py b/systers_portal/community/migrations/0001_initial.py index 823e7790..5663f364 100644 --- a/systers_portal/community/migrations/0001_initial.py +++ b/systers_portal/community/migrations/0001_initial.py @@ -1,36 +1,77 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals +# Generated by Django 2.0 on 2020-07-08 16:09 -from django.db import models, migrations +import ckeditor.fields +from django.db import migrations, models class Migration(migrations.Migration): + initial = True + dependencies = [ - ('users', '0001_squashed_0003_auto_20160207_1550'), ] operations = [ migrations.CreateModel( name='Community', fields=[ - ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('name', models.CharField(max_length=255, verbose_name=b'Name')), - ('slug', models.SlugField(unique=True, max_length=150, verbose_name=b'Slug')), - ('order', models.IntegerField(unique=True, verbose_name=b'Order')), - ('email', models.EmailField(max_length=255, verbose_name=b'Email', blank=True)), - ('mailing_list', models.EmailField(max_length=255, verbose_name=b'Mailing list', blank=True)), - ('website', models.URLField(max_length=255, verbose_name=b'Website', blank=True)), - ('facebook', models.URLField(max_length=255, verbose_name=b'Facebook', blank=True)), - ('googleplus', models.URLField(max_length=255, verbose_name=b'Google+', blank=True)), - ('twitter', models.URLField(max_length=255, verbose_name=b'Twitter', blank=True)), - ('community_admin', models.ForeignKey(related_name=b'community', verbose_name=b'Community admin', to='users.SystersUser')), - ('members', models.ManyToManyField(related_name=b'communities', null=True, verbose_name=b'Members', to='users.SystersUser', blank=True)), - ('parent_community', models.ForeignKey(verbose_name=b'Parent community', blank=True, to='community.Community', null=True)), + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=255, verbose_name='Name')), + ('slug', models.SlugField(max_length=150, unique=True, verbose_name='Slug')), + ('order', models.IntegerField(unique=True, verbose_name='Order')), + ('email', models.EmailField(blank=True, max_length=255, verbose_name='Email')), + ('mailing_list', models.EmailField(blank=True, max_length=255, verbose_name='Mailing list')), + ('website', models.URLField(blank=True, max_length=255, verbose_name='Website')), + ('facebook', models.URLField(blank=True, max_length=255, verbose_name='Facebook')), + ('googleplus', models.URLField(blank=True, max_length=255, verbose_name='Google+')), + ('twitter', models.URLField(blank=True, max_length=255, verbose_name='Twitter')), ], options={ 'verbose_name_plural': 'Communities', + 'permissions': (('add_community_systersuser', 'Add community Systers User'), ('change_community_systersuser', 'Change community Systers User'), ('delete_community_systersuser', 'Delete community Systers User'), ('add_community_news', 'Add community news'), ('change_community_news', 'Change community news'), ('delete_community_news', 'Delete community news'), ('add_community_resource', 'Add community resource'), ('change_community_resource', 'Change community resource'), ('delete_community_resource', 'Delete community resource'), ('add_community_page', 'Add community page'), ('change_community_page', 'Change community page'), ('delete_community_page', 'Delete community page'), ('approve_community_comment', 'Approve community comment'), ('delete_community_comment', 'Delete community comment'), ('approve_community_joinrequest', 'Approve community join request')), }, - bases=(models.Model,), + ), + migrations.CreateModel( + name='CommunityPage', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('slug', models.SlugField(max_length=150, verbose_name='Slug')), + ('title', models.CharField(max_length=255, verbose_name='Title')), + ('date_created', models.DateField(auto_now_add=True, verbose_name='Date published')), + ('date_modified', models.DateField(auto_now=True, verbose_name='Date last modified')), + ('content', ckeditor.fields.RichTextField(verbose_name='Content')), + ('order', models.IntegerField(verbose_name='Order')), + ], + ), + migrations.CreateModel( + name='RequestCommunity', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=255, verbose_name='Proposed Community Name')), + ('slug', models.SlugField(max_length=150, unique=True, verbose_name='Slug')), + ('order', models.PositiveIntegerField(blank=True, null=True, verbose_name='Order')), + ('email', models.EmailField(blank=True, max_length=255, verbose_name=' At what email address would you like to be contacted?')), + ('mailing_list', models.EmailField(blank=True, max_length=255, verbose_name='Mailing list of the community')), + ('website', models.URLField(blank=True, max_length=255, verbose_name='Link to the website')), + ('facebook', models.URLField(blank=True, max_length=255, verbose_name='Link to the community on Facebook')), + ('googleplus', models.URLField(blank=True, max_length=255, verbose_name='Link to the community on Google+')), + ('twitter', models.URLField(blank=True, max_length=255, verbose_name='Link to the community on Twitter')), + ('is_member', models.CharField(choices=[('Yes', 'Yes'), ('No', 'No')], default=None, max_length=25, verbose_name='Are you a member of Systers?')), + ('email_id', models.EmailField(blank=True, max_length=255, verbose_name='What email have you used to sign up for Systers?')), + ('type_community', models.CharField(choices=[('Affinity Group', 'Affinity Group (Latinas in Computing, LGBT, etc)'), ('Special Interest Group', 'Special Interest Group (Student Researchers, Systers in Government,Women in Cyber Security, etc) '), ('Email list', 'Email list (using Mailman3)'), ('Other', 'Other')], default=None, max_length=255, verbose_name='Type of Community')), + ('other_community_type', models.CharField(blank=True, max_length=255, verbose_name='Other type of community(Please specify)')), + ('community_channel', models.CharField(choices=[('Existing Social Media Channels ', 'Existing Social Media Channels '), ('Request New Social Media Channels ', 'Request New Social Media Channels ')], default=None, max_length=255, verbose_name='Online Community Channels')), + ('social_presence', models.CharField(max_length=255, null=True, verbose_name='Check off all the social media accounts you can manage for your proposed community:')), + ('other_account', models.CharField(blank=True, max_length=25, verbose_name='Other social channel(Please specify)')), + ('demographic_target_count', models.TextField(blank=True, verbose_name='Who will it serve ( explain target demographics and number of people):')), + ('purpose', models.TextField(blank=True, verbose_name='Explain the purpose and need for this group or account:')), + ('is_avail_volunteer', models.CharField(choices=[('Yes', 'Yes'), ('No', 'No')], default=None, max_length=25, verbose_name='Do you have volunteers committed?')), + ('count_avail_volunteer', models.PositiveIntegerField(default=0, verbose_name='If yes, how many?')), + ('content_developer', models.TextField(blank=True, verbose_name='Explain the content of this group. What service will this group provide (example: discussion, linksharing, support)? Who will develop the content? What kind of content will be shared in the group? How often will moderators post/engage with users?')), + ('selection_criteria', models.TextField(blank=True, verbose_name='Will there be screening of new members of will this group be open to anyone? If there will be screening,what will the criteria for membership be?')), + ('is_real_time', models.TextField(blank=True, verbose_name=' Will there be real-time meetings in addition to an online community? (Example, at the Grace Hopper Celebration; regional meetings; etc)')), + ('is_approved', models.BooleanField(default=False, verbose_name='Approved')), + ('date_created', models.DateTimeField(auto_now_add=True, verbose_name='Date created')), + ], ), ] diff --git a/systers_portal/community/migrations/0002_auto_20200708_1609.py b/systers_portal/community/migrations/0002_auto_20200708_1609.py new file mode 100644 index 00000000..92bcead2 --- /dev/null +++ b/systers_portal/community/migrations/0002_auto_20200708_1609.py @@ -0,0 +1,72 @@ +# Generated by Django 2.0 on 2020-07-08 16:09 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ('users', '0001_initial'), + ('community', '0001_initial'), + ('cities_light', '0006_compensate_for_0003_bytestring_bug'), + ] + + operations = [ + migrations.AddField( + model_name='requestcommunity', + name='approved_by', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='users.SystersUser', verbose_name='Approved by'), + ), + migrations.AddField( + model_name='requestcommunity', + name='location', + field=models.ForeignKey(default='', on_delete=django.db.models.deletion.CASCADE, to='cities_light.City', verbose_name='Location'), + ), + migrations.AddField( + model_name='requestcommunity', + name='parent_community', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='community.Community', verbose_name='Parent community'), + ), + migrations.AddField( + model_name='requestcommunity', + name='user', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='requestor', to='users.SystersUser', verbose_name='Created by'), + ), + migrations.AddField( + model_name='communitypage', + name='author', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='users.SystersUser', verbose_name='Author'), + ), + migrations.AddField( + model_name='communitypage', + name='community', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='community.Community', verbose_name='Community'), + ), + migrations.AddField( + model_name='community', + name='admin', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='community', to='users.SystersUser', verbose_name='Community admin'), + ), + migrations.AddField( + model_name='community', + name='location', + field=models.ForeignKey(default='', on_delete=django.db.models.deletion.DO_NOTHING, to='cities_light.City', verbose_name='Location'), + ), + migrations.AddField( + model_name='community', + name='members', + field=models.ManyToManyField(blank=True, related_name='communities', to='users.SystersUser', verbose_name='Members'), + ), + migrations.AddField( + model_name='community', + name='parent_community', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='community.Community', verbose_name='Parent community'), + ), + migrations.AlterUniqueTogether( + name='communitypage', + unique_together={('community', 'order'), ('community', 'slug')}, + ), + ] diff --git a/systers_portal/community/migrations/0002_communitypage.py b/systers_portal/community/migrations/0002_communitypage.py deleted file mode 100644 index 26c54e50..00000000 --- a/systers_portal/community/migrations/0002_communitypage.py +++ /dev/null @@ -1,33 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import models, migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('users', '0001_squashed_0003_auto_20160207_1550'), - ('community', '0001_initial'), - ] - - operations = [ - migrations.CreateModel( - name='CommunityPage', - fields=[ - ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('slug', models.SlugField(unique=True, max_length=150, verbose_name=b'Slug')), - ('title', models.CharField(max_length=255, verbose_name=b'Title')), - ('date_created', models.DateField(auto_now_add=True, verbose_name=b'Date published')), - ('date_modified', models.DateField(auto_now=True, verbose_name=b'Date last modified')), - ('content', models.TextField(verbose_name=b'Content')), - ('order', models.IntegerField(unique=True, verbose_name=b'Order')), - ('author', models.ForeignKey(verbose_name=b'Author', to='users.SystersUser')), - ('community', models.ForeignKey(verbose_name=b'Community', to='community.Community')), - ], - options={ - 'abstract': False, - }, - bases=(models.Model,), - ), - ] diff --git a/systers_portal/community/migrations/0003_auto_20140928_2034.py b/systers_portal/community/migrations/0003_auto_20140928_2034.py deleted file mode 100644 index 4f6b0bf4..00000000 --- a/systers_portal/community/migrations/0003_auto_20140928_2034.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import models, migrations -import ckeditor.fields - - -class Migration(migrations.Migration): - - dependencies = [ - ('community', '0002_communitypage'), - ] - - operations = [ - migrations.AlterField( - model_name='communitypage', - name='content', - field=ckeditor.fields.RichTextField(verbose_name=b'Content'), - ), - ] diff --git a/systers_portal/community/migrations/0004_joinrequest.py b/systers_portal/community/migrations/0004_joinrequest.py deleted file mode 100644 index 889eceb2..00000000 --- a/systers_portal/community/migrations/0004_joinrequest.py +++ /dev/null @@ -1,29 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import models, migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('users', '0001_squashed_0003_auto_20160207_1550'), - ('community', '0003_auto_20140928_2034'), - ] - - operations = [ - migrations.CreateModel( - name='JoinRequest', - fields=[ - ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('date_created', models.DateTimeField(auto_now_add=True)), - ('is_approved', models.BooleanField(default=False)), - ('approved_by', models.ForeignKey(related_name=b'approved_by', blank=True, to='users.SystersUser', null=True)), - ('community', models.ForeignKey(to='community.Community')), - ('user', models.ForeignKey(related_name=b'created_by', to='users.SystersUser')), - ], - options={ - }, - bases=(models.Model,), - ), - ] diff --git a/systers_portal/community/migrations/0005_auto_20141006_2117.py b/systers_portal/community/migrations/0005_auto_20141006_2117.py deleted file mode 100644 index c98b60db..00000000 --- a/systers_portal/community/migrations/0005_auto_20141006_2117.py +++ /dev/null @@ -1,18 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import models, migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('community', '0004_joinrequest'), - ] - - operations = [ - migrations.AlterModelOptions( - name='community', - options={'verbose_name_plural': 'Communities', 'permissions': (('add_community_systersuser', 'Add community Systers User'), ('change_community_systersuser', 'Change community Systers User'), ('delete_community_systersuser', 'Delete community Systers User'), ('add_community_news', 'Add community news'), ('change_community_news', 'Change community news'), ('delete_community_news', 'Delete community news'), ('add_community_resource', 'Add community resource'), ('change_community_resource', 'Change community resource'), ('delete_community_resource', 'Delete community resource'), ('add_community_page', 'Add community page'), ('change_community_page', 'Change community page'), ('delete_community_page', 'Delete community page'), ('approve_community_comment', 'Approve community comment'), ('delete_community_comment', 'Delete community comment'), ('approve_community_joinrequest', 'Approve community join request'))}, - ), - ] diff --git a/systers_portal/community/migrations/0006_auto_20150208_0818.py b/systers_portal/community/migrations/0006_auto_20150208_0818.py deleted file mode 100644 index 20149d08..00000000 --- a/systers_portal/community/migrations/0006_auto_20150208_0818.py +++ /dev/null @@ -1,29 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import models, migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('community', '0005_auto_20141006_2117'), - ] - - operations = [ - migrations.RemoveField( - model_name='joinrequest', - name='approved_by', - ), - migrations.RemoveField( - model_name='joinrequest', - name='community', - ), - migrations.RemoveField( - model_name='joinrequest', - name='user', - ), - migrations.DeleteModel( - name='JoinRequest', - ), - ] diff --git a/systers_portal/community/migrations/0007_auto_20150227_0728.py b/systers_portal/community/migrations/0007_auto_20150227_0728.py deleted file mode 100644 index f20a7b88..00000000 --- a/systers_portal/community/migrations/0007_auto_20150227_0728.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import models, migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('community', '0006_auto_20150208_0818'), - ] - - operations = [ - migrations.RenameField( - model_name='community', - old_name='community_admin', - new_name='admin', - ), - ] diff --git a/systers_portal/community/migrations/0008_auto_20150420_1504.py b/systers_portal/community/migrations/0008_auto_20150420_1504.py deleted file mode 100644 index 121dc158..00000000 --- a/systers_portal/community/migrations/0008_auto_20150420_1504.py +++ /dev/null @@ -1,135 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import models, migrations -import ckeditor.fields - - -class Migration(migrations.Migration): - - dependencies = [ - ('community', '0007_auto_20150227_0728'), - ] - - operations = [ - migrations.AlterField( - model_name='community', - name='admin', - field=models.ForeignKey(verbose_name='Community admin', to='users.SystersUser', related_name='community'), - preserve_default=True, - ), - migrations.AlterField( - model_name='community', - name='email', - field=models.EmailField(blank=True, verbose_name='Email', max_length=255), - preserve_default=True, - ), - migrations.AlterField( - model_name='community', - name='facebook', - field=models.URLField(blank=True, verbose_name='Facebook', max_length=255), - preserve_default=True, - ), - migrations.AlterField( - model_name='community', - name='googleplus', - field=models.URLField(blank=True, verbose_name='Google+', max_length=255), - preserve_default=True, - ), - migrations.AlterField( - model_name='community', - name='mailing_list', - field=models.EmailField(blank=True, verbose_name='Mailing list', max_length=255), - preserve_default=True, - ), - migrations.AlterField( - model_name='community', - name='members', - field=models.ManyToManyField(null=True, blank=True, verbose_name='Members', to='users.SystersUser', related_name='communities'), - preserve_default=True, - ), - migrations.AlterField( - model_name='community', - name='name', - field=models.CharField(verbose_name='Name', max_length=255), - preserve_default=True, - ), - migrations.AlterField( - model_name='community', - name='order', - field=models.IntegerField(unique=True, verbose_name='Order'), - preserve_default=True, - ), - migrations.AlterField( - model_name='community', - name='parent_community', - field=models.ForeignKey(blank=True, verbose_name='Parent community', to='community.Community', null=True), - preserve_default=True, - ), - migrations.AlterField( - model_name='community', - name='slug', - field=models.SlugField(unique=True, verbose_name='Slug', max_length=150), - preserve_default=True, - ), - migrations.AlterField( - model_name='community', - name='twitter', - field=models.URLField(blank=True, verbose_name='Twitter', max_length=255), - preserve_default=True, - ), - migrations.AlterField( - model_name='community', - name='website', - field=models.URLField(blank=True, verbose_name='Website', max_length=255), - preserve_default=True, - ), - migrations.AlterField( - model_name='communitypage', - name='author', - field=models.ForeignKey(verbose_name='Author', to='users.SystersUser'), - preserve_default=True, - ), - migrations.AlterField( - model_name='communitypage', - name='community', - field=models.ForeignKey(verbose_name='Community', to='community.Community'), - preserve_default=True, - ), - migrations.AlterField( - model_name='communitypage', - name='content', - field=ckeditor.fields.RichTextField(verbose_name='Content'), - preserve_default=True, - ), - migrations.AlterField( - model_name='communitypage', - name='date_created', - field=models.DateField(auto_now_add=True, verbose_name='Date published'), - preserve_default=True, - ), - migrations.AlterField( - model_name='communitypage', - name='date_modified', - field=models.DateField(auto_now=True, verbose_name='Date last modified'), - preserve_default=True, - ), - migrations.AlterField( - model_name='communitypage', - name='order', - field=models.IntegerField(unique=True, verbose_name='Order'), - preserve_default=True, - ), - migrations.AlterField( - model_name='communitypage', - name='slug', - field=models.SlugField(verbose_name='Slug', max_length=150), - preserve_default=True, - ), - migrations.AlterField( - model_name='communitypage', - name='title', - field=models.CharField(verbose_name='Title', max_length=255), - preserve_default=True, - ), - ] diff --git a/systers_portal/community/migrations/0009_auto_20150420_1536.py b/systers_portal/community/migrations/0009_auto_20150420_1536.py deleted file mode 100644 index 5e606c04..00000000 --- a/systers_portal/community/migrations/0009_auto_20150420_1536.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import models, migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('community', '0008_auto_20150420_1504'), - ] - - operations = [ - migrations.AlterField( - model_name='communitypage', - name='order', - field=models.IntegerField(verbose_name='Order'), - preserve_default=True, - ), - ] diff --git a/systers_portal/community/migrations/0010_auto_20150522_1138.py b/systers_portal/community/migrations/0010_auto_20150522_1138.py deleted file mode 100644 index 5c0425cf..00000000 --- a/systers_portal/community/migrations/0010_auto_20150522_1138.py +++ /dev/null @@ -1,18 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import models, migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('community', '0009_auto_20150420_1536'), - ] - - operations = [ - migrations.AlterUniqueTogether( - name='communitypage', - unique_together=set([('community', 'slug'), ('community', 'order')]), - ), - ] diff --git a/systers_portal/community/migrations/0011_auto_20150522_1233.py b/systers_portal/community/migrations/0011_auto_20150522_1233.py deleted file mode 100644 index 64b54744..00000000 --- a/systers_portal/community/migrations/0011_auto_20150522_1233.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import models, migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('community', '0010_auto_20150522_1138'), - ] - - operations = [ - migrations.AlterField( - model_name='community', - name='members', - field=models.ManyToManyField(blank=True, related_name='communities', to='users.SystersUser', verbose_name='Members'), - ), - ] diff --git a/systers_portal/community/migrations/0012_requestcommunity.py b/systers_portal/community/migrations/0012_requestcommunity.py deleted file mode 100644 index a94bfec8..00000000 --- a/systers_portal/community/migrations/0012_requestcommunity.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.11.6 on 2018-03-09 12:17 -from __future__ import unicode_literals - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('users', '0001_squashed_0003_auto_20160207_1550'), - ('community', '0011_auto_20150522_1233'), - ] - - operations = [ - migrations.CreateModel( - name='RequestCommunity', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(max_length=255, verbose_name='Proposed Community Name')), - ('slug', models.SlugField(max_length=150, unique=True, verbose_name='Slug')), - ('order', models.PositiveIntegerField(blank=True, null=True, verbose_name='Order')), - ('email', models.EmailField(blank=True, max_length=255, verbose_name=' At what email address would you like to be contacted?')), - ('mailing_list', models.EmailField(blank=True, max_length=255, verbose_name='Mailing list of the community')), - ('website', models.URLField(blank=True, max_length=255, verbose_name='Link to the website')), - ('facebook', models.URLField(blank=True, max_length=255, verbose_name='Link to the community on Facebook')), - ('googleplus', models.URLField(blank=True, max_length=255, verbose_name='Link to the community on Google+')), - ('twitter', models.URLField(blank=True, max_length=255, verbose_name='Link to the community on Twitter')), - ('is_member', models.CharField(choices=[('Yes', 'Yes'), ('No', 'No')], default=None, max_length=25, verbose_name='Are you a member of Systers?')), - ('email_id', models.EmailField(blank=True, max_length=255, verbose_name='What email have you used to sign up for Systers?')), - ('type_community', models.CharField(choices=[('Affinity Group', 'Affinity Group (Latinas in Computing, LGBT, etc'), ('Special Interest Group', 'Special Interest Group (Student Researchers, Systers in Government,Women in Cyber Security, etc) '), ('Email list', 'Email list (using Mailman3)'), ('Other', 'Other')], default=None, max_length=255, verbose_name='Type of Community')), - ('other_community_type', models.CharField(blank=True, max_length=255, verbose_name='Other type of community(Please specify)')), - ('community_channel', models.CharField(choices=[('Existing Social Media Channels ', 'Existing Social Media Channels '), ('Request New Social Media Channels ', 'Request New Social Media Channels ')], default=None, max_length=255, verbose_name='Online Community Channels')), - ('social_presence', models.CharField(max_length=255, null=True, verbose_name='Check off all the social media accounts you can manage for your proposed community:')), - ('other_account', models.CharField(blank=True, max_length=25, verbose_name='Other social channel(Please specify)')), - ('demographic_target_count', models.TextField(blank=True, verbose_name='Who will it serve ( explain target demographics and number of people):')), - ('purpose', models.TextField(blank=True, verbose_name='Explain the purpose and need for this group or account:')), - ('is_avail_volunteer', models.CharField(choices=[('Yes', 'Yes'), ('No', 'No')], default=None, max_length=25, verbose_name='Do you have volunteers committed?')), - ('count_avail_volunteer', models.PositiveIntegerField(default=0, verbose_name='If yes, how many?')), - ('content_developer', models.TextField(blank=True, verbose_name='Explain the content of this group. What service will this group provide (example: discussion, linksharing, support)? Who will develop the content? What kind of content will be shared in the group? How often will moderators post/engage with users?')), - ('selection_criteria', models.TextField(blank=True, verbose_name='Will there be screening of new members of will this group be open to anyone? If there will be screening,what will the criteria for membership be?')), - ('is_real_time', models.TextField(blank=True, verbose_name=' Will there be real-time meetings in addition to an online community? (Example, at the Grace Hopper Celebration; regional meetings; etc)')), - ('is_approved', models.BooleanField(default=False, verbose_name='Approved')), - ('date_created', models.DateTimeField(auto_now_add=True, verbose_name='Date created')), - ('approved_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='users.SystersUser', verbose_name='Approved by')), - ('parent_community', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='community.Community', verbose_name='Parent community')), - ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='requestor', to='users.SystersUser', verbose_name='Created by')), - ], - ), - ] diff --git a/systers_portal/community/migrations/0013_auto_20200316_1806.py b/systers_portal/community/migrations/0013_auto_20200316_1806.py deleted file mode 100644 index ec8e9dd7..00000000 --- a/systers_portal/community/migrations/0013_auto_20200316_1806.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.11.6 on 2020-03-16 18:06 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('community', '0012_requestcommunity'), - ] - - operations = [ - migrations.AlterField( - model_name='requestcommunity', - name='type_community', - field=models.CharField(choices=[('Affinity Group', 'Affinity Group (Latinas in Computing, LGBT, etc)'), ('Special Interest Group', 'Special Interest Group (Student Researchers, Systers in Government,Women in Cyber Security, etc) '), ('Email list', 'Email list (using Mailman3)'), ('Other', 'Other')], default=None, max_length=255, verbose_name='Type of Community'), - ), - ] diff --git a/systers_portal/community/migrations/0013_auto_20200403_1757.py b/systers_portal/community/migrations/0013_auto_20200403_1757.py deleted file mode 100644 index 058d7334..00000000 --- a/systers_portal/community/migrations/0013_auto_20200403_1757.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.11.6 on 2020-04-03 17:57 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('community', '0012_requestcommunity'), - ] - - operations = [ - migrations.AlterField( - model_name='requestcommunity', - name='type_community', - field=models.CharField(choices=[('Affinity Group', 'Affinity Group (Latinas in Computing, LGBT, etc)'), ('Special Interest Group', 'Special Interest Group (Student Researchers, Systers in Government,Women in Cyber Security, etc) '), ('Email list', 'Email list (using Mailman3)'), ('Other', 'Other')], default=None, max_length=255, verbose_name='Type of Community'), - ), - ] diff --git a/systers_portal/community/migrations/0014_auto_20200324_1252.py b/systers_portal/community/migrations/0014_auto_20200324_1252.py deleted file mode 100644 index 4feb2025..00000000 --- a/systers_portal/community/migrations/0014_auto_20200324_1252.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.11.6 on 2020-03-24 12:52 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('community', '0013_auto_20200316_1806'), - ] - - operations = [ - migrations.AlterField( - model_name='requestcommunity', - name='type_community', - field=models.CharField(choices=[('Affinity Group', 'Affinity Group (Latinas in Computing, LGBT, etc'), ('Special Interest Group', 'Special Interest Group (Student Researchers, Systers in Government,Women in Cyber Security, etc) '), ('Email list', 'Email list (using Mailman3)'), ('Other', 'Other')], default=None, max_length=255, verbose_name='Type of Community'), - ), - ] diff --git a/systers_portal/community/migrations/0015_merge_20200404_0832.py b/systers_portal/community/migrations/0015_merge_20200404_0832.py deleted file mode 100644 index 57373a97..00000000 --- a/systers_portal/community/migrations/0015_merge_20200404_0832.py +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.11.6 on 2020-04-04 08:32 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('community', '0013_auto_20200403_1757'), - ('community', '0014_auto_20200324_1252'), - ] - - operations = [ - ] diff --git a/systers_portal/community/migrations/0016_auto_20200606_0719.py b/systers_portal/community/migrations/0016_auto_20200606_0719.py deleted file mode 100644 index 3e8e6e5d..00000000 --- a/systers_portal/community/migrations/0016_auto_20200606_0719.py +++ /dev/null @@ -1,27 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.11.6 on 2020-06-06 07:19 -from __future__ import unicode_literals - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('cities_light', '0006_compensate_for_0003_bytestring_bug'), - ('community', '0015_merge_20200404_0832'), - ] - - operations = [ - migrations.AddField( - model_name='community', - name='location', - field=models.ForeignKey(default='', on_delete=django.db.models.deletion.CASCADE, to='cities_light.City', verbose_name='Location'), - ), - migrations.AddField( - model_name='requestcommunity', - name='location', - field=models.ForeignKey(default='', on_delete=django.db.models.deletion.CASCADE, to='cities_light.City', verbose_name='Location'), - ), - ] diff --git a/systers_portal/community/migrations/0017_auto_20200608_1920.py b/systers_portal/community/migrations/0017_auto_20200608_1920.py deleted file mode 100644 index 5dbc3b94..00000000 --- a/systers_portal/community/migrations/0017_auto_20200608_1920.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.11.6 on 2020-06-08 19:20 -from __future__ import unicode_literals - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('community', '0016_auto_20200606_0719'), - ] - - operations = [ - migrations.AlterField( - model_name='community', - name='location', - field=models.ForeignKey(default='', on_delete=django.db.models.deletion.DO_NOTHING, to='cities_light.City', verbose_name='Location'), - ), - ] diff --git a/systers_portal/community/models.py b/systers_portal/community/models.py index dd1393e0..4de0063f 100644 --- a/systers_portal/community/models.py +++ b/systers_portal/community/models.py @@ -1,5 +1,5 @@ from django.contrib.auth.models import Group -from django.core.urlresolvers import reverse +from django.urls import reverse from django.db import models from common.models import Post @@ -25,9 +25,9 @@ class Community(models.Model): related_name='communities', verbose_name="Members") admin = models.ForeignKey(SystersUser, related_name='community', - verbose_name="Community admin") + verbose_name="Community admin", on_delete=models.CASCADE) parent_community = models.ForeignKey('self', blank=True, null=True, - verbose_name="Parent community") + verbose_name="Parent community", on_delete=models.CASCADE) website = models.URLField(max_length=255, blank=True, verbose_name="Website") facebook = models.URLField(max_length=255, blank=True, @@ -144,13 +144,14 @@ class RequestCommunity(models.Model): slug = models.SlugField(max_length=150, unique=True, verbose_name="Slug") order = models.PositiveIntegerField( null=True, blank=True, verbose_name="Order") - location = models.ForeignKey(City, verbose_name="Location", default="") + location = models.ForeignKey(City, verbose_name="Location", + default="", on_delete=models.CASCADE) email = models.EmailField(max_length=255, blank=True, verbose_name=" At what email address would you like to be contacted?") mailing_list = models.EmailField(max_length=255, blank=True, verbose_name="Mailing list of the community") parent_community = models.ForeignKey(Community, blank=True, null=True, - verbose_name="Parent community") + verbose_name="Parent community", on_delete=models.CASCADE) website = models.URLField(max_length=255, blank=True, verbose_name="Link to the website") facebook = models.URLField(max_length=255, blank=True, @@ -197,10 +198,10 @@ class RequestCommunity(models.Model): verbose_name=" Will there be real-time meetings in addition to an online community?\ (Example, at the Grace Hopper Celebration; regional meetings; etc)") user = models.ForeignKey( - SystersUser, verbose_name="Created by", related_name="requestor") + SystersUser, verbose_name="Created by", related_name="requestor", on_delete=models.CASCADE) is_approved = models.BooleanField(default=False, verbose_name="Approved") approved_by = models.ForeignKey(SystersUser, blank=True, null=True, - verbose_name='Approved by') + verbose_name='Approved by', on_delete=models.CASCADE) date_created = models.DateTimeField( auto_now_add=True, verbose_name="Date created") @@ -228,7 +229,7 @@ def get_verbose_fields(self): class CommunityPage(Post): """Model to represent an arbitrary community page""" order = models.IntegerField(verbose_name="Order") - community = models.ForeignKey(Community, verbose_name="Community") + community = models.ForeignKey(Community, verbose_name="Community", on_delete=models.CASCADE) class Meta: unique_together = (('community', 'slug'), ('community', 'order')) diff --git a/systers_portal/community/tests/test_context_processors.py b/systers_portal/community/tests/test_context_processors.py new file mode 100644 index 00000000..29bf35e9 --- /dev/null +++ b/systers_portal/community/tests/test_context_processors.py @@ -0,0 +1,32 @@ +from cities_light.models import Country, City +from django.contrib.auth.models import User +from django.urls import reverse +from django.test import TestCase, Client + +from users.models import SystersUser +from community.models import Community + + +class CommunitiesProcessorTestCase(TestCase): + def setUp(self): + self.user = User.objects.create(username='foo', password='foobar') + self.systers_user = SystersUser.objects.get(user=self.user) + self.client = Client() + + def test_communities_processor(self): + """Test the rendering of all communities in the templates""" + country = Country.objects.create(name='Bar', continent='AS') + location = City.objects.create(name='Foo', display_name='Foo', + country=country) + Community.objects.create(name="Foo", slug="foo", + order=1, location=location, + admin=self.systers_user) + Community.objects.create(name="Boo", slug="boo", + order=2, location=location, + admin=self.systers_user) + index_url = reverse('index') + response = self.client.get(index_url) + self.assertContains(response, 'Foo') + self.assertContains(response, 'Boo') diff --git a/systers_portal/community/tests/test_views.py b/systers_portal/community/tests/test_views.py index 7f5016d1..e5791fbb 100644 --- a/systers_portal/community/tests/test_views.py +++ b/systers_portal/community/tests/test_views.py @@ -1,6 +1,6 @@ from cities_light.models import City, Country from django.contrib.auth.models import User, Group -from django.core.urlresolvers import reverse +from django.urls import reverse from django.db.models.signals import post_save, post_delete from django.test import TestCase diff --git a/systers_portal/community/views.py b/systers_portal/community/views.py index 69b945db..89b260f6 100644 --- a/systers_portal/community/views.py +++ b/systers_portal/community/views.py @@ -1,6 +1,6 @@ from django.contrib.auth.models import User from django.contrib import messages -from django.core.urlresolvers import reverse +from django.urls import reverse from django.http import JsonResponse from django.shortcuts import get_object_or_404, render from django.template.loader import render_to_string diff --git a/systers_portal/meetup/migrations/0001_initial.py b/systers_portal/meetup/migrations/0001_initial.py index 9ab4eec6..3bc00b17 100644 --- a/systers_portal/meetup/migrations/0001_initial.py +++ b/systers_portal/meetup/migrations/0001_initial.py @@ -1,6 +1,4 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.11.6 on 2018-08-08 17:45 -from __future__ import unicode_literals +# Generated by Django 2.0 on 2020-07-08 16:09 import ckeditor.fields from django.db import migrations, models @@ -12,9 +10,6 @@ class Migration(migrations.Migration): initial = True dependencies = [ - ('cities_light', '0006_compensate_for_0003_bytestring_bug'), - ('users', '0001_squashed_0003_auto_20160207_1550'), - ('cities_light', '0006_compensate_for_0003_bytestring_bug'), ] operations = [ @@ -31,26 +26,10 @@ class Migration(migrations.Migration): ('venue', models.CharField(blank=True, max_length=512, verbose_name='Venue')), ('description', models.TextField(verbose_name='Description')), ('last_updated', models.DateTimeField(auto_now=True, verbose_name='Last Update')), - ('created_by', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='users.SystersUser', verbose_name='Created By')), - ], - ), - migrations.CreateModel( - name='MeetupLocation', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(max_length=255, unique=True, verbose_name='Name')), - ('slug', models.SlugField(max_length=150, unique=True, verbose_name='Slug')), - ('description', ckeditor.fields.RichTextField(verbose_name='Description')), - ('email', models.EmailField(blank=True, max_length=255, verbose_name='Email')), - ('sponsors', ckeditor.fields.RichTextField(blank=True, verbose_name='Sponsors')), - ('join_requests', models.ManyToManyField(blank=True, related_name='Join_Requests', to='users.SystersUser', verbose_name='Join Requests')), - ('leader', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='community_leader', to='users.SystersUser', verbose_name='Community leader')), - ('location', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='cities_light.City', verbose_name='Location')), - ('members', models.ManyToManyField(blank=True, related_name='community_members', to='users.SystersUser', verbose_name='Community Members')), - ('moderators', models.ManyToManyField(related_name='community_moderators', to='users.SystersUser', verbose_name='Community Moderators')), + ('meetup_picture', models.ImageField(blank=True, null=True, upload_to='meetup/pictures/', verbose_name='Meetup picture')), ], options={ - 'permissions': (('add_meetup_location_member', 'Add meetup location member'), ('delete_meetup_location_member', 'Delete meetup location member'), ('add_meetup_location_moderator', 'Add meetup location moderator'), ('delete_meetup_location_moderator', 'Delete meetup location moderator'), ('approve_meetup_location_joinrequest', 'Approve meetup location join request'), ('reject_meetup_location_joinrequest', 'Reject meetup location join request'), ('approve_meetup_location_meetuprequest', 'Approve meetup location meetup request'), ('reject_meetup_location_meetuprequest', 'Reject meetup location meetup request'), ('view_meetup_location_meetuprequest', 'View meetup location meetup request'), ('approve_meetup_comment', 'Approve comment for a meetup'), ('reject_meetup_comment', 'Reject comment for a meetup'), ('add_meetup_rsvp', 'RSVP for a meetup'), ('approve_support_request', 'Approve support request'), ('reject_support_request', 'Reject support request'), ('add_support_request_comment', 'Add comment for a support request'), ('edit_support_request_comment', 'Edit comment for a support request'), ('delete_support_request_comment', 'Delete comment for a support request'), ('approve_support_request_comment', 'Approve comment for a support request'), ('reject_support_request_comment', 'Reject comment for a support request')), + 'permissions': (('view_meetup_request', 'View Meetup Request'), ('approve_meetup_request', 'Approve Meetup Request'), ('reject_meetup_request', 'Reject Meetup Request'), ('add_meetups', 'Add Meetups'), ('delete_meetups', 'Delete Meetup'), ('change_meetups', 'Change Meetup'), ('add_meetup_rsvp', 'Add Meetup RSVP'), ('add_support_request', 'Add Support Request'), ('edit_support_request', 'Edit Support Request'), ('delete_support_request', 'Delete Support Request'), ('approve_support_request', 'Approve Support Request'), ('reject_support_request', 'Reject Support Request'), ('add_support_request_comment', 'Add Support Request Comment')), }, ), migrations.CreateModel( @@ -65,24 +44,6 @@ class Migration(migrations.Migration): ('description', ckeditor.fields.RichTextField(verbose_name='Description')), ('date_created', models.DateTimeField(auto_now_add=True)), ('is_approved', models.BooleanField(default=False)), - ('approved_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='approvedBy', to='users.SystersUser')), - ('created_by', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='users.SystersUser', verbose_name='Created By')), - ('meetup_location', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='meetup.MeetupLocation', verbose_name='Meetup Location')), - ], - ), - migrations.CreateModel( - name='RequestMeetupLocation', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(max_length=255, unique=True, verbose_name='Name of the Meetup Location.(Naming convention for Systers meetup location is City+Systers.e.g.London Systers, Boston Systers.)')), - ('slug', models.SlugField(max_length=150, unique=True, verbose_name='Slug of the Meetup Location')), - ('description', ckeditor.fields.RichTextField(verbose_name='Description of the Meetup Location')), - ('email', models.EmailField(blank=True, max_length=255, verbose_name='Email of the Meetup Location if any.')), - ('date_created', models.DateTimeField(auto_now_add=True, verbose_name='Date Created')), - ('is_approved', models.BooleanField(default=False, verbose_name='Is this Approved?')), - ('approved_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='approvedby', to='users.SystersUser', verbose_name='Approved By')), - ('location', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='cities_light.City', verbose_name='Location')), - ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='createdby', to='users.SystersUser', verbose_name='Requested By')), ], ), migrations.CreateModel( @@ -91,8 +52,6 @@ class Migration(migrations.Migration): ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('coming', models.BooleanField(default=True)), ('plus_one', models.BooleanField(default=False)), - ('meetup', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='meetup.Meetup', verbose_name='Meetup')), - ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='users.SystersUser', verbose_name='User')), ], ), migrations.CreateModel( @@ -102,16 +61,6 @@ class Migration(migrations.Migration): ('description', models.TextField(blank=True, verbose_name='Description')), ('is_approved', models.BooleanField(default=False)), ('meetup', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='meetup.Meetup', verbose_name='Meetup')), - ('volunteer', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='users.SystersUser', verbose_name='Volunteer')), ], ), - migrations.AddField( - model_name='meetup', - name='meetup_location', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='meetup.MeetupLocation', verbose_name='Meetup Location'), - ), - migrations.AlterUniqueTogether( - name='rsvp', - unique_together=set([('user', 'meetup')]), - ), ] diff --git a/systers_portal/meetup/migrations/0002_auto_20200708_1609.py b/systers_portal/meetup/migrations/0002_auto_20200708_1609.py new file mode 100644 index 00000000..28eabf86 --- /dev/null +++ b/systers_portal/meetup/migrations/0002_auto_20200708_1609.py @@ -0,0 +1,67 @@ +# Generated by Django 2.0 on 2020-07-08 16:09 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ('meetup', '0001_initial'), + ('users', '0001_initial'), + ('cities_light', '0006_compensate_for_0003_bytestring_bug'), + ] + + operations = [ + migrations.AddField( + model_name='supportrequest', + name='volunteer', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='users.SystersUser', verbose_name='Volunteer'), + ), + migrations.AddField( + model_name='rsvp', + name='meetup', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='meetup.Meetup', verbose_name='Meetup'), + ), + migrations.AddField( + model_name='rsvp', + name='user', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='users.SystersUser', verbose_name='User'), + ), + migrations.AddField( + model_name='requestmeetup', + name='approved_by', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='approvedBy', to='users.SystersUser'), + ), + migrations.AddField( + model_name='requestmeetup', + name='created_by', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='users.SystersUser', verbose_name='Created By'), + ), + migrations.AddField( + model_name='requestmeetup', + name='meetup_location', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='cities_light.City', verbose_name='Meetup Location'), + ), + migrations.AddField( + model_name='meetup', + name='created_by', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='users.SystersUser', verbose_name='Created By'), + ), + migrations.AddField( + model_name='meetup', + name='leader', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='community_leader', to='users.SystersUser', verbose_name='Community leader'), + ), + migrations.AddField( + model_name='meetup', + name='meetup_location', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='cities_light.City', verbose_name='Meetup Location'), + ), + migrations.AlterUniqueTogether( + name='rsvp', + unique_together={('user', 'meetup')}, + ), + ] diff --git a/systers_portal/meetup/migrations/0002_meetup_meetup_picture.py b/systers_portal/meetup/migrations/0002_meetup_meetup_picture.py deleted file mode 100644 index 3245b250..00000000 --- a/systers_portal/meetup/migrations/0002_meetup_meetup_picture.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.11.6 on 2020-03-16 14:26 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('meetup', '0001_initial'), - ] - - operations = [ - migrations.AddField( - model_name='meetup', - name='meetup_picture', - field=models.ImageField(blank=True, null=True, upload_to='meetup/pictures/', verbose_name='Meetup picture'), - ), - ] diff --git a/systers_portal/meetup/migrations/0003_auto_20200620_2133.py b/systers_portal/meetup/migrations/0003_auto_20200620_2133.py deleted file mode 100644 index eda24a39..00000000 --- a/systers_portal/meetup/migrations/0003_auto_20200620_2133.py +++ /dev/null @@ -1,74 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.11.6 on 2020-06-20 21:33 -from __future__ import unicode_literals - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('users', '0001_squashed_0003_auto_20160207_1550'), - ('meetup', '0002_meetup_meetup_picture'), - ] - - operations = [ - migrations.RemoveField( - model_name='meetuplocation', - name='join_requests', - ), - migrations.RemoveField( - model_name='meetuplocation', - name='leader', - ), - migrations.RemoveField( - model_name='meetuplocation', - name='location', - ), - migrations.RemoveField( - model_name='meetuplocation', - name='members', - ), - migrations.RemoveField( - model_name='meetuplocation', - name='moderators', - ), - migrations.RemoveField( - model_name='requestmeetuplocation', - name='approved_by', - ), - migrations.RemoveField( - model_name='requestmeetuplocation', - name='location', - ), - migrations.RemoveField( - model_name='requestmeetuplocation', - name='user', - ), - migrations.AlterModelOptions( - name='meetup', - options={'permissions': (('view_meetup_request', 'View Meetup Request'), ('approve_meetup_request', 'Approve Meetup Request'), ('reject_meetup_request', 'Reject Meetup Request'), ('add_meetups', 'Add Meetups'), ('delete_meetups', 'Delete Meetup'), ('change_meetups', 'Change Meetup'), ('add_meetup_rsvp', 'Add Meetup RSVP'), ('add_support_request', 'Add Support Request'), ('edit_support_request', 'Edit Support Request'), ('delete_support_request', 'Delete Support Request'), ('approve_support_request', 'Approve Support Request'), ('reject_support_request', 'Reject Support Request'), ('add_support_request_comment', 'Add Support Request Comment'))}, - ), - migrations.AddField( - model_name='meetup', - name='leader', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='community_leader', to='users.SystersUser', verbose_name='Community leader'), - ), - migrations.AlterField( - model_name='meetup', - name='meetup_location', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='cities_light.City', verbose_name='Meetup Location'), - ), - migrations.AlterField( - model_name='requestmeetup', - name='meetup_location', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='cities_light.City', verbose_name='Meetup Location'), - ), - migrations.DeleteModel( - name='MeetupLocation', - ), - migrations.DeleteModel( - name='RequestMeetupLocation', - ), - ] diff --git a/systers_portal/meetup/migrations/0004_auto_20200620_2144.py b/systers_portal/meetup/migrations/0004_auto_20200620_2144.py deleted file mode 100644 index 76c8dadf..00000000 --- a/systers_portal/meetup/migrations/0004_auto_20200620_2144.py +++ /dev/null @@ -1,26 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.11.6 on 2020-06-20 21:44 -from __future__ import unicode_literals - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('meetup', '0003_auto_20200620_2133'), - ] - - operations = [ - migrations.AlterField( - model_name='meetup', - name='meetup_location', - field=models.ForeignKey(blank=True, on_delete=django.db.models.deletion.CASCADE, to='cities_light.City', verbose_name='Meetup Location'), - ), - migrations.AlterField( - model_name='requestmeetup', - name='meetup_location', - field=models.ForeignKey(blank=True, on_delete=django.db.models.deletion.CASCADE, to='cities_light.City', verbose_name='Meetup Location'), - ), - ] diff --git a/systers_portal/meetup/migrations/0005_auto_20200620_2145.py b/systers_portal/meetup/migrations/0005_auto_20200620_2145.py deleted file mode 100644 index 76496516..00000000 --- a/systers_portal/meetup/migrations/0005_auto_20200620_2145.py +++ /dev/null @@ -1,26 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.11.6 on 2020-06-20 21:45 -from __future__ import unicode_literals - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('meetup', '0004_auto_20200620_2144'), - ] - - operations = [ - migrations.AlterField( - model_name='meetup', - name='meetup_location', - field=models.ForeignKey(default='', on_delete=django.db.models.deletion.CASCADE, to='cities_light.City', verbose_name='Meetup Location'), - ), - migrations.AlterField( - model_name='requestmeetup', - name='meetup_location', - field=models.ForeignKey(default='', on_delete=django.db.models.deletion.CASCADE, to='cities_light.City', verbose_name='Meetup Location'), - ), - ] diff --git a/systers_portal/meetup/migrations/0006_auto_20200620_2146.py b/systers_portal/meetup/migrations/0006_auto_20200620_2146.py deleted file mode 100644 index b3464a4f..00000000 --- a/systers_portal/meetup/migrations/0006_auto_20200620_2146.py +++ /dev/null @@ -1,26 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.11.6 on 2020-06-20 21:46 -from __future__ import unicode_literals - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('meetup', '0005_auto_20200620_2145'), - ] - - operations = [ - migrations.AlterField( - model_name='meetup', - name='meetup_location', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='cities_light.City', verbose_name='Meetup Location'), - ), - migrations.AlterField( - model_name='requestmeetup', - name='meetup_location', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='cities_light.City', verbose_name='Meetup Location'), - ), - ] diff --git a/systers_portal/meetup/models.py b/systers_portal/meetup/models.py index 4da050a4..a815f24d 100644 --- a/systers_portal/meetup/models.py +++ b/systers_portal/meetup/models.py @@ -16,9 +16,11 @@ class Meetup(models.Model): venue = models.CharField(max_length=512, verbose_name="Venue", blank=True) description = models.TextField(verbose_name="Description") leader = models.ForeignKey(SystersUser, null=True, blank=True, related_name='community_leader', - verbose_name="Community leader") - meetup_location = models.ForeignKey(City, verbose_name="Meetup Location") - created_by = models.ForeignKey(SystersUser, null=True, verbose_name="Created By") + verbose_name="Community leader", on_delete=models.CASCADE) + meetup_location = models.ForeignKey( + City, verbose_name="Meetup Location", on_delete=models.CASCADE) + created_by = models.ForeignKey( + SystersUser, null=True, verbose_name="Created By", on_delete=models.CASCADE) last_updated = models.DateTimeField(auto_now=True, verbose_name="Last Update") meetup_picture = models.ImageField(upload_to='meetup/pictures/', blank=True, @@ -54,10 +56,12 @@ class RequestMeetup(models.Model): time = models.TimeField(verbose_name="Time", blank=True) venue = models.CharField(max_length=512, verbose_name="Venue", blank=True) description = RichTextField(verbose_name="Description") - meetup_location = models.ForeignKey(City, verbose_name="Meetup Location") - created_by = models.ForeignKey(SystersUser, null=True, verbose_name="Created By") + meetup_location = models.ForeignKey( + City, verbose_name="Meetup Location", on_delete=models.CASCADE) + created_by = models.ForeignKey( + SystersUser, null=True, verbose_name="Created By", on_delete=models.CASCADE) approved_by = models.ForeignKey(SystersUser, blank=True, null=True, - related_name='approvedBy') + related_name='approvedBy', on_delete=models.CASCADE) date_created = models.DateTimeField(auto_now_add=True) is_approved = models.BooleanField(default=False) @@ -74,8 +78,8 @@ def __str__(self): class Rsvp(models.Model): """ Users RSVP for particular meetup """ - user = models.ForeignKey(SystersUser, verbose_name="User") - meetup = models.ForeignKey(Meetup, verbose_name="Meetup") + user = models.ForeignKey(SystersUser, verbose_name="User", on_delete=models.CASCADE) + meetup = models.ForeignKey(Meetup, verbose_name="Meetup", on_delete=models.CASCADE) coming = models.BooleanField(default=True) plus_one = models.BooleanField(default=False) @@ -88,8 +92,8 @@ def __str__(self): class SupportRequest(models.Model): """Manage details of various volunteering activities""" - volunteer = models.ForeignKey(SystersUser, verbose_name="Volunteer") - meetup = models.ForeignKey(Meetup, verbose_name="Meetup") + volunteer = models.ForeignKey(SystersUser, verbose_name="Volunteer", on_delete=models.CASCADE) + meetup = models.ForeignKey(Meetup, verbose_name="Meetup", on_delete=models.CASCADE) description = models.TextField(verbose_name="Description", blank=True) is_approved = models.BooleanField(default=False) diff --git a/systers_portal/meetup/tests/test_views.py b/systers_portal/meetup/tests/test_views.py index c3894680..2c1f04da 100644 --- a/systers_portal/meetup/tests/test_views.py +++ b/systers_portal/meetup/tests/test_views.py @@ -1,6 +1,6 @@ import json from django.contrib.auth.models import User -from django.core.urlresolvers import reverse +from django.urls import reverse from django.test import TestCase, Client from django.utils import timezone from cities_light.models import City, Country diff --git a/systers_portal/meetup/views.py b/systers_portal/meetup/views.py index 6c66d522..b6f97033 100644 --- a/systers_portal/meetup/views.py +++ b/systers_portal/meetup/views.py @@ -3,7 +3,7 @@ from django.contrib.gis.geoip2 import GeoIP2 from django.contrib.gis.geos import Point -from django.core.urlresolvers import reverse +from django.urls import reverse from django.db.models import Q from django.shortcuts import get_object_or_404 from django.views.decorators.csrf import csrf_exempt diff --git a/systers_portal/membership/migrations/0001_initial.py b/systers_portal/membership/migrations/0001_initial.py index 47e45666..659eb7db 100644 --- a/systers_portal/membership/migrations/0001_initial.py +++ b/systers_portal/membership/migrations/0001_initial.py @@ -1,29 +1,22 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals +# Generated by Django 2.0 on 2020-07-08 16:09 -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): + initial = True + dependencies = [ - ('users', '0001_squashed_0003_auto_20160207_1550'), - ('community', '0006_auto_20150208_0818'), ] operations = [ migrations.CreateModel( name='JoinRequest', fields=[ - ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('date_created', models.DateTimeField(auto_now_add=True)), ('is_approved', models.BooleanField(default=False)), - ('approved_by', models.ForeignKey(related_name='approved_by', blank=True, to='users.SystersUser', null=True)), - ('community', models.ForeignKey(to='community.Community')), - ('user', models.ForeignKey(related_name='created_by', to='users.SystersUser')), ], - options={ - }, - bases=(models.Model,), ), ] diff --git a/systers_portal/membership/migrations/0002_auto_20200708_1609.py b/systers_portal/membership/migrations/0002_auto_20200708_1609.py new file mode 100644 index 00000000..e41433f5 --- /dev/null +++ b/systers_portal/membership/migrations/0002_auto_20200708_1609.py @@ -0,0 +1,33 @@ +# Generated by Django 2.0 on 2020-07-08 16:09 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ('users', '0001_initial'), + ('community', '0001_initial'), + ('membership', '0001_initial'), + ] + + operations = [ + migrations.AddField( + model_name='joinrequest', + name='approved_by', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='approved_by', to='users.SystersUser'), + ), + migrations.AddField( + model_name='joinrequest', + name='community', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='community.Community'), + ), + migrations.AddField( + model_name='joinrequest', + name='user', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='created_by', to='users.SystersUser'), + ), + ] diff --git a/systers_portal/membership/models.py b/systers_portal/membership/models.py index 2f05b3c1..1052242b 100644 --- a/systers_portal/membership/models.py +++ b/systers_portal/membership/models.py @@ -41,10 +41,10 @@ def cancel_join_request(self, user, community): class JoinRequest(models.Model): """Model to represent a request to join a community by a user""" - user = models.ForeignKey(SystersUser, related_name='created_by') + user = models.ForeignKey(SystersUser, related_name='created_by', on_delete=models.CASCADE) approved_by = models.ForeignKey(SystersUser, blank=True, null=True, - related_name='approved_by') - community = models.ForeignKey(Community) + related_name='approved_by', on_delete=models.CASCADE) + community = models.ForeignKey(Community, on_delete=models.CASCADE) date_created = models.DateTimeField(auto_now_add=True) is_approved = models.BooleanField(default=False) diff --git a/systers_portal/membership/tests/test_views.py b/systers_portal/membership/tests/test_views.py index f27fb513..13428258 100644 --- a/systers_portal/membership/tests/test_views.py +++ b/systers_portal/membership/tests/test_views.py @@ -1,6 +1,6 @@ from cities_light.models import Country, City from django.contrib.auth.models import User, Group -from django.core.urlresolvers import reverse +from django.urls import reverse from django.test import TestCase from community.constants import USER_CONTENT_MANAGER diff --git a/systers_portal/membership/views.py b/systers_portal/membership/views.py index 8134f517..aeb4fc48 100644 --- a/systers_portal/membership/views.py +++ b/systers_portal/membership/views.py @@ -1,6 +1,6 @@ from django.contrib import messages from django.contrib.auth.models import User -from django.core.urlresolvers import reverse +from django.urls import reverse from django.shortcuts import get_object_or_404 from django.views.generic import RedirectView, ListView, FormView from django.views.generic.detail import SingleObjectMixin diff --git a/systers_portal/systers_portal/settings/base.py b/systers_portal/systers_portal/settings/base.py index 7138f9d7..203df2af 100644 --- a/systers_portal/systers_portal/settings/base.py +++ b/systers_portal/systers_portal/settings/base.py @@ -57,7 +57,7 @@ 'pinax.notifications', ) -MIDDLEWARE_CLASSES = ( +MIDDLEWARE = [ 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', @@ -66,7 +66,7 @@ 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'django.middleware.locale.LocaleMiddleware', 'django.contrib.admindocs.middleware.XViewMiddleware', -) +] AUTHENTICATION_BACKENDS = ( 'django.contrib.auth.backends.ModelBackend', diff --git a/systers_portal/systers_portal/urls.py b/systers_portal/systers_portal/urls.py index e04fe466..b04b7b46 100644 --- a/systers_portal/systers_portal/urls.py +++ b/systers_portal/systers_portal/urls.py @@ -23,7 +23,7 @@ url(r'^community/', include('membership.urls')), url(r'^meetup/', include('meetup.urls')), url(r'^users/', include('users.urls')), - url(r'^admin/', include(admin.site.urls)), + url(r'^admin/', admin.site.urls), url(r'^logout/', Logout.as_view(), name='logout'), url(r'^accounts/', include('allauth.urls')), url(r'^ckeditor/upload/', login_required(views), diff --git a/systers_portal/templates/account/login.html b/systers_portal/templates/account/login.html index 4bd81caa..96d8794c 100644 --- a/systers_portal/templates/account/login.html +++ b/systers_portal/templates/account/login.html @@ -7,35 +7,34 @@ {% load crispy_forms_tags %} {% block content %} {% load socialaccount %} -{% load staticfiles %} -