stash progress so far. found ViMbAdmin, using that instead.
This commit is contained in:
		
							parent
							
								
									b3c6599c7f
								
							
						
					
					
						commit
						1d01e66a4d
					
				
					 59 changed files with 46465 additions and 0 deletions
				
			
		
							
								
								
									
										8
									
								
								backend/.idea/.gitignore
									
										
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								backend/.idea/.gitignore
									
										
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,8 @@
 | 
			
		|||
# Default ignored files
 | 
			
		||||
/shelf/
 | 
			
		||||
/workspace.xml
 | 
			
		||||
# Datasource local storage ignored files
 | 
			
		||||
/dataSources/
 | 
			
		||||
/dataSources.local.xml
 | 
			
		||||
# Editor-based HTTP Client requests
 | 
			
		||||
/httpRequests/
 | 
			
		||||
							
								
								
									
										30
									
								
								backend/.idea/backend.iml
									
										
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								backend/.idea/backend.iml
									
										
									
										generated
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,30 @@
 | 
			
		|||
<?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
<module type="PYTHON_MODULE" version="4">
 | 
			
		||||
  <component name="FacetManager">
 | 
			
		||||
    <facet type="django" name="Django">
 | 
			
		||||
      <configuration>
 | 
			
		||||
        <option name="rootFolder" value="$MODULE_DIR$" />
 | 
			
		||||
        <option name="settingsModule" value="backend/settings.py" />
 | 
			
		||||
        <option name="manageScript" value="$MODULE_DIR$/manage.py" />
 | 
			
		||||
        <option name="environment" value="<map/>" />
 | 
			
		||||
        <option name="doNotUseTestRunner" value="false" />
 | 
			
		||||
        <option name="trackFilePattern" value="migrations" />
 | 
			
		||||
      </configuration>
 | 
			
		||||
    </facet>
 | 
			
		||||
  </component>
 | 
			
		||||
  <component name="NewModuleRootManager">
 | 
			
		||||
    <content url="file://$MODULE_DIR$">
 | 
			
		||||
      <excludeFolder url="file://$MODULE_DIR$/venv" />
 | 
			
		||||
    </content>
 | 
			
		||||
    <orderEntry type="inheritedJdk" />
 | 
			
		||||
    <orderEntry type="sourceFolder" forTests="false" />
 | 
			
		||||
  </component>
 | 
			
		||||
  <component name="TemplatesService">
 | 
			
		||||
    <option name="TEMPLATE_CONFIGURATION" value="Django" />
 | 
			
		||||
    <option name="TEMPLATE_FOLDERS">
 | 
			
		||||
      <list>
 | 
			
		||||
        <option value="$MODULE_DIR$/templates" />
 | 
			
		||||
      </list>
 | 
			
		||||
    </option>
 | 
			
		||||
  </component>
 | 
			
		||||
</module>
 | 
			
		||||
							
								
								
									
										11
									
								
								backend/.idea/dataSources.xml
									
										
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								backend/.idea/dataSources.xml
									
										
									
										generated
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,11 @@
 | 
			
		|||
<?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
<project version="4">
 | 
			
		||||
  <component name="DataSourceManagerImpl" format="xml" multifile-model="true">
 | 
			
		||||
    <data-source source="LOCAL" name="db" uuid="6686f610-375b-4b13-ba78-9f1cf18741af">
 | 
			
		||||
      <driver-ref>sqlite.xerial</driver-ref>
 | 
			
		||||
      <synchronize>true</synchronize>
 | 
			
		||||
      <jdbc-driver>org.sqlite.JDBC</jdbc-driver>
 | 
			
		||||
      <jdbc-url>jdbc:sqlite:$PROJECT_DIR$/db.sqlite3</jdbc-url>
 | 
			
		||||
    </data-source>
 | 
			
		||||
  </component>
 | 
			
		||||
</project>
 | 
			
		||||
							
								
								
									
										6
									
								
								backend/.idea/inspectionProfiles/profiles_settings.xml
									
										
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								backend/.idea/inspectionProfiles/profiles_settings.xml
									
										
									
										generated
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,6 @@
 | 
			
		|||
<component name="InspectionProjectProfileManager">
 | 
			
		||||
  <settings>
 | 
			
		||||
    <option name="USE_PROJECT_PROFILE" value="false" />
 | 
			
		||||
    <version value="1.0" />
 | 
			
		||||
  </settings>
 | 
			
		||||
</component>
 | 
			
		||||
							
								
								
									
										4
									
								
								backend/.idea/misc.xml
									
										
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								backend/.idea/misc.xml
									
										
									
										generated
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,4 @@
 | 
			
		|||
<?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
<project version="4">
 | 
			
		||||
  <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.8 (backend)" project-jdk-type="Python SDK" />
 | 
			
		||||
</project>
 | 
			
		||||
							
								
								
									
										8
									
								
								backend/.idea/modules.xml
									
										
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								backend/.idea/modules.xml
									
										
									
										generated
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,8 @@
 | 
			
		|||
<?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
<project version="4">
 | 
			
		||||
  <component name="ProjectModuleManager">
 | 
			
		||||
    <modules>
 | 
			
		||||
      <module fileurl="file://$PROJECT_DIR$/.idea/backend.iml" filepath="$PROJECT_DIR$/.idea/backend.iml" />
 | 
			
		||||
    </modules>
 | 
			
		||||
  </component>
 | 
			
		||||
</project>
 | 
			
		||||
							
								
								
									
										6
									
								
								backend/.idea/vcs.xml
									
										
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								backend/.idea/vcs.xml
									
										
									
										generated
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,6 @@
 | 
			
		|||
<?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
<project version="4">
 | 
			
		||||
  <component name="VcsDirectoryMappings">
 | 
			
		||||
    <mapping directory="$PROJECT_DIR$/.." vcs="Git" />
 | 
			
		||||
  </component>
 | 
			
		||||
</project>
 | 
			
		||||
							
								
								
									
										0
									
								
								backend/backend/__init__.py
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								backend/backend/__init__.py
									
										
									
									
									
										Normal file
									
								
							
							
								
								
									
										16
									
								
								backend/backend/asgi.py
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								backend/backend/asgi.py
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,16 @@
 | 
			
		|||
"""
 | 
			
		||||
ASGI config for backend project.
 | 
			
		||||
 | 
			
		||||
It exposes the ASGI callable as a module-level variable named ``application``.
 | 
			
		||||
 | 
			
		||||
For more information on this file, see
 | 
			
		||||
https://docs.djangoproject.com/en/3.1/howto/deployment/asgi/
 | 
			
		||||
"""
 | 
			
		||||
 | 
			
		||||
import os
 | 
			
		||||
 | 
			
		||||
from django.core.asgi import get_asgi_application
 | 
			
		||||
 | 
			
		||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'backend.settings')
 | 
			
		||||
 | 
			
		||||
application = get_asgi_application()
 | 
			
		||||
							
								
								
									
										22
									
								
								backend/backend/urls.py
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								backend/backend/urls.py
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,22 @@
 | 
			
		|||
"""backend URL Configuration
 | 
			
		||||
 | 
			
		||||
The `urlpatterns` list routes URLs to views. For more information please see:
 | 
			
		||||
    https://docs.djangoproject.com/en/3.1/topics/http/urls/
 | 
			
		||||
Examples:
 | 
			
		||||
Function views
 | 
			
		||||
    1. Add an import:  from my_app import views
 | 
			
		||||
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
 | 
			
		||||
Class-based views
 | 
			
		||||
    1. Add an import:  from other_app.views import Home
 | 
			
		||||
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
 | 
			
		||||
Including another URLconf
 | 
			
		||||
    1. Import the include() function: from django.urls import include, path
 | 
			
		||||
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
 | 
			
		||||
"""
 | 
			
		||||
from django.contrib import admin
 | 
			
		||||
from django.urls import include, path
 | 
			
		||||
 | 
			
		||||
urlpatterns = [
 | 
			
		||||
    path('multimail/', include('multimail.urls')),
 | 
			
		||||
    path('admin/', admin.site.urls),
 | 
			
		||||
]
 | 
			
		||||
							
								
								
									
										16
									
								
								backend/backend/wsgi.py
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								backend/backend/wsgi.py
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,16 @@
 | 
			
		|||
"""
 | 
			
		||||
WSGI config for backend project.
 | 
			
		||||
 | 
			
		||||
It exposes the WSGI callable as a module-level variable named ``application``.
 | 
			
		||||
 | 
			
		||||
For more information on this file, see
 | 
			
		||||
https://docs.djangoproject.com/en/3.1/howto/deployment/wsgi/
 | 
			
		||||
"""
 | 
			
		||||
 | 
			
		||||
import os
 | 
			
		||||
 | 
			
		||||
from django.core.wsgi import get_wsgi_application
 | 
			
		||||
 | 
			
		||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'backend.settings')
 | 
			
		||||
 | 
			
		||||
application = get_wsgi_application()
 | 
			
		||||
							
								
								
									
										0
									
								
								backend/config/__init__.py
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								backend/config/__init__.py
									
										
									
									
									
										Normal file
									
								
							
							
								
								
									
										0
									
								
								backend/config/ldap.py
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								backend/config/ldap.py
									
										
									
									
									
										Normal file
									
								
							
							
								
								
									
										22
									
								
								backend/manage.py
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										22
									
								
								backend/manage.py
									
										
									
									
									
										Executable file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,22 @@
 | 
			
		|||
#!/usr/bin/env python
 | 
			
		||||
"""Django's command-line utility for administrative tasks."""
 | 
			
		||||
import os
 | 
			
		||||
import sys
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def main():
 | 
			
		||||
    """Run administrative tasks."""
 | 
			
		||||
    os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'backend.settings')
 | 
			
		||||
    try:
 | 
			
		||||
        from django.core.management import execute_from_command_line
 | 
			
		||||
    except ImportError as exc:
 | 
			
		||||
        raise ImportError(
 | 
			
		||||
            "Couldn't import Django. Are you sure it's installed and "
 | 
			
		||||
            "available on your PYTHONPATH environment variable? Did you "
 | 
			
		||||
            "forget to activate a virtual environment?"
 | 
			
		||||
        ) from exc
 | 
			
		||||
    execute_from_command_line(sys.argv)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
if __name__ == '__main__':
 | 
			
		||||
    main()
 | 
			
		||||
							
								
								
									
										0
									
								
								backend/multimail/__init__.py
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								backend/multimail/__init__.py
									
										
									
									
									
										Normal file
									
								
							
							
								
								
									
										29
									
								
								backend/multimail/actions.py
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								backend/multimail/actions.py
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,29 @@
 | 
			
		|||
from django.http import HttpResponseRedirect
 | 
			
		||||
from django.shortcuts import get_object_or_404, render
 | 
			
		||||
from django.urls import reverse
 | 
			
		||||
from django.views import generic
 | 
			
		||||
from django.utils import timezone
 | 
			
		||||
from django.contrib.auth.decorators import login_required
 | 
			
		||||
from django.contrib.auth.mixins import LoginRequiredMixin
 | 
			
		||||
 | 
			
		||||
from .models import Choice, Question, Domain
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@login_required(login_url='/login/')
 | 
			
		||||
def vote(request, question_id):
 | 
			
		||||
    question = get_object_or_404(Question, pk=question_id)
 | 
			
		||||
    try:
 | 
			
		||||
        selected_choice = question.choice_set.get(pk=request.POST['choice'])
 | 
			
		||||
    except (KeyError, Choice.DoesNotExist):
 | 
			
		||||
        # Redisplay the question voting form.
 | 
			
		||||
        return render(request, 'multimail/detail.html', {
 | 
			
		||||
            'question': question,
 | 
			
		||||
            'error_message': "You didn't select a choice.",
 | 
			
		||||
        })
 | 
			
		||||
    else:
 | 
			
		||||
        selected_choice.votes += 1
 | 
			
		||||
        selected_choice.save()
 | 
			
		||||
        # Always return an HttpResponseRedirect after successfully dealing
 | 
			
		||||
        # with POST data. This prevents data from being posted twice if a
 | 
			
		||||
        # user hits the Back button.
 | 
			
		||||
        return HttpResponseRedirect(reverse('multimail:results', args=(question.id,)))
 | 
			
		||||
							
								
								
									
										32
									
								
								backend/multimail/admin.py
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								backend/multimail/admin.py
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,32 @@
 | 
			
		|||
from django.contrib import admin
 | 
			
		||||
 | 
			
		||||
from .models import Choice, Question
 | 
			
		||||
from .models import Alias, Domain, Mailbox, TLSPolicy
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class ChoiceInline(admin.TabularInline):
 | 
			
		||||
    model = Choice
 | 
			
		||||
    extra = 1
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class QuestionAdmin(admin.ModelAdmin):
 | 
			
		||||
    fieldsets = [
 | 
			
		||||
        (None, {'fields': ['question_text']}),
 | 
			
		||||
        ('Date information', {'fields': ['pub_date'], 'classes': ['collapse']}),
 | 
			
		||||
    ]
 | 
			
		||||
    list_display = ('question_text', 'pub_date', 'was_published_recently')
 | 
			
		||||
    inlines = [ChoiceInline]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
admin.site.register(Question, QuestionAdmin)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class TLSPolicyAdmin(admin.ModelAdmin):
 | 
			
		||||
    list_display = ('domain', 'policy', 'params')
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
admin.site.register(TLSPolicy, TLSPolicyAdmin)
 | 
			
		||||
 | 
			
		||||
admin.site.register(Alias)
 | 
			
		||||
admin.site.register(Domain)
 | 
			
		||||
admin.site.register(Mailbox)
 | 
			
		||||
							
								
								
									
										5
									
								
								backend/multimail/apps.py
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								backend/multimail/apps.py
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,5 @@
 | 
			
		|||
from django.apps import AppConfig
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class MultimailConfig(AppConfig):
 | 
			
		||||
    name = 'multimail'
 | 
			
		||||
							
								
								
									
										32
									
								
								backend/multimail/migrations/0001_initial.py
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								backend/multimail/migrations/0001_initial.py
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,32 @@
 | 
			
		|||
# Generated by Django 3.1.3 on 2020-11-02 18:55
 | 
			
		||||
 | 
			
		||||
from django.db import migrations, models
 | 
			
		||||
import django.db.models.deletion
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class Migration(migrations.Migration):
 | 
			
		||||
 | 
			
		||||
    initial = True
 | 
			
		||||
 | 
			
		||||
    dependencies = [
 | 
			
		||||
    ]
 | 
			
		||||
 | 
			
		||||
    operations = [
 | 
			
		||||
        migrations.CreateModel(
 | 
			
		||||
            name='Question',
 | 
			
		||||
            fields=[
 | 
			
		||||
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
 | 
			
		||||
                ('question_text', models.CharField(max_length=200)),
 | 
			
		||||
                ('pub_date', models.DateTimeField(verbose_name='date published')),
 | 
			
		||||
            ],
 | 
			
		||||
        ),
 | 
			
		||||
        migrations.CreateModel(
 | 
			
		||||
            name='Choice',
 | 
			
		||||
            fields=[
 | 
			
		||||
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
 | 
			
		||||
                ('choice_text', models.CharField(max_length=200)),
 | 
			
		||||
                ('votes', models.IntegerField(default=0)),
 | 
			
		||||
                ('question', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='multimail.question')),
 | 
			
		||||
            ],
 | 
			
		||||
        ),
 | 
			
		||||
    ]
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,68 @@
 | 
			
		|||
# Generated by Django 3.1.3 on 2020-11-02 21:11
 | 
			
		||||
 | 
			
		||||
from django.db import migrations, models
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class Migration(migrations.Migration):
 | 
			
		||||
 | 
			
		||||
    dependencies = [
 | 
			
		||||
        ('multimail', '0001_initial'),
 | 
			
		||||
    ]
 | 
			
		||||
 | 
			
		||||
    operations = [
 | 
			
		||||
        migrations.CreateModel(
 | 
			
		||||
            name='Aliases',
 | 
			
		||||
            fields=[
 | 
			
		||||
                ('id', models.AutoField(primary_key=True, serialize=False)),
 | 
			
		||||
                ('source_username', models.CharField(max_length=64)),
 | 
			
		||||
                ('source_domain', models.CharField(max_length=255)),
 | 
			
		||||
                ('destination_username', models.CharField(max_length=64)),
 | 
			
		||||
                ('destination_domain', models.CharField(max_length=255)),
 | 
			
		||||
                ('enabled', models.IntegerField(blank=True, null=True)),
 | 
			
		||||
            ],
 | 
			
		||||
            options={
 | 
			
		||||
                'db_table': 'aliases',
 | 
			
		||||
                'managed': False,
 | 
			
		||||
            },
 | 
			
		||||
        ),
 | 
			
		||||
        migrations.CreateModel(
 | 
			
		||||
            name='Domains',
 | 
			
		||||
            fields=[
 | 
			
		||||
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
 | 
			
		||||
                ('domain', models.CharField(max_length=255)),
 | 
			
		||||
            ],
 | 
			
		||||
            options={
 | 
			
		||||
                'db_table': 'domains',
 | 
			
		||||
                'managed': False,
 | 
			
		||||
            },
 | 
			
		||||
        ),
 | 
			
		||||
        migrations.CreateModel(
 | 
			
		||||
            name='Mailboxes',
 | 
			
		||||
            fields=[
 | 
			
		||||
                ('id', models.AutoField(primary_key=True, serialize=False)),
 | 
			
		||||
                ('username', models.CharField(max_length=64)),
 | 
			
		||||
                ('domain', models.CharField(max_length=255)),
 | 
			
		||||
                ('password', models.CharField(max_length=255)),
 | 
			
		||||
                ('quota', models.IntegerField(blank=True, null=True)),
 | 
			
		||||
                ('enabled', models.IntegerField(blank=True, null=True)),
 | 
			
		||||
                ('sendonly', models.IntegerField(blank=True, null=True)),
 | 
			
		||||
            ],
 | 
			
		||||
            options={
 | 
			
		||||
                'db_table': 'mailboxes',
 | 
			
		||||
                'managed': False,
 | 
			
		||||
            },
 | 
			
		||||
        ),
 | 
			
		||||
        migrations.CreateModel(
 | 
			
		||||
            name='Tlspolicies',
 | 
			
		||||
            fields=[
 | 
			
		||||
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
 | 
			
		||||
                ('domain', models.CharField(max_length=255)),
 | 
			
		||||
                ('policy', models.TextField()),
 | 
			
		||||
                ('params', models.CharField(blank=True, max_length=255, null=True)),
 | 
			
		||||
            ],
 | 
			
		||||
            options={
 | 
			
		||||
                'db_table': 'tlspolicies',
 | 
			
		||||
                'managed': False,
 | 
			
		||||
            },
 | 
			
		||||
        ),
 | 
			
		||||
    ]
 | 
			
		||||
							
								
								
									
										0
									
								
								backend/multimail/migrations/__init__.py
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								backend/multimail/migrations/__init__.py
									
										
									
									
									
										Normal file
									
								
							
							
								
								
									
										69
									
								
								backend/multimail/models.py
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										69
									
								
								backend/multimail/models.py
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,69 @@
 | 
			
		|||
import datetime
 | 
			
		||||
from django.db import models
 | 
			
		||||
from django.utils import timezone
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class Question(models.Model):
 | 
			
		||||
    question_text = models.CharField(max_length=200)
 | 
			
		||||
    pub_date = models.DateTimeField('date published')
 | 
			
		||||
 | 
			
		||||
    def __str__(self):
 | 
			
		||||
        return self.question_text
 | 
			
		||||
 | 
			
		||||
    def was_published_recently(self):
 | 
			
		||||
        now = timezone.now()
 | 
			
		||||
        return now - datetime.timedelta(days=1) <= self.pub_date <= now
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class Choice(models.Model):
 | 
			
		||||
    question = models.ForeignKey(Question, on_delete=models.CASCADE)
 | 
			
		||||
    choice_text = models.CharField(max_length=200)
 | 
			
		||||
    votes = models.IntegerField(default=0)
 | 
			
		||||
 | 
			
		||||
    def __str__(self):
 | 
			
		||||
        return self.choice_text
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class Alias(models.Model):
 | 
			
		||||
    id = models.AutoField(primary_key=True)
 | 
			
		||||
    source_username = models.CharField(max_length=64)
 | 
			
		||||
    source_domain = models.CharField(max_length=255)
 | 
			
		||||
    destination_username = models.CharField(max_length=64)
 | 
			
		||||
    destination_domain = models.CharField(max_length=255)
 | 
			
		||||
    enabled = models.IntegerField(blank=True, null=True)
 | 
			
		||||
 | 
			
		||||
    class Meta:
 | 
			
		||||
        managed = False
 | 
			
		||||
        db_table = 'aliases'
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class Domain(models.Model):
 | 
			
		||||
    domain = models.CharField(max_length=255)
 | 
			
		||||
 | 
			
		||||
    class Meta:
 | 
			
		||||
        managed = False
 | 
			
		||||
        db_table = 'domains'
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class Mailbox(models.Model):
 | 
			
		||||
    id = models.AutoField(primary_key=True)
 | 
			
		||||
    username = models.CharField(max_length=64)
 | 
			
		||||
    domain = models.CharField(max_length=255)
 | 
			
		||||
    password = models.CharField(max_length=255)
 | 
			
		||||
    quota = models.IntegerField(blank=True, null=True)
 | 
			
		||||
    enabled = models.IntegerField(blank=True, null=True)
 | 
			
		||||
    sendonly = models.IntegerField(blank=True, null=True)
 | 
			
		||||
 | 
			
		||||
    class Meta:
 | 
			
		||||
        managed = False
 | 
			
		||||
        db_table = 'mailboxes'
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class TLSPolicy(models.Model):
 | 
			
		||||
    domain = models.CharField(max_length=255)
 | 
			
		||||
    policy = models.TextField()
 | 
			
		||||
    params = models.CharField(max_length=255, blank=True, null=True)
 | 
			
		||||
 | 
			
		||||
    class Meta:
 | 
			
		||||
        managed = False
 | 
			
		||||
        db_table = 'tlspolicies'
 | 
			
		||||
							
								
								
									
										50
									
								
								backend/multimail/static/multimail/css/simple-sidebar.css
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										50
									
								
								backend/multimail/static/multimail/css/simple-sidebar.css
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,50 @@
 | 
			
		|||
/*!
 | 
			
		||||
 * Start Bootstrap - Simple Sidebar (https://startbootstrap.com/templates/simple-sidebar)
 | 
			
		||||
 * Copyright 2013-2020 Start Bootstrap
 | 
			
		||||
 * Licensed under MIT (https://github.com/StartBootstrap/startbootstrap-simple-sidebar/blob/master/LICENSE)
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
 #wrapper {
 | 
			
		||||
    overflow-x: hidden;
 | 
			
		||||
 }
 | 
			
		||||
 | 
			
		||||
#sidebar-wrapper {
 | 
			
		||||
  min-height: 100vh;
 | 
			
		||||
  margin-left: -15rem;
 | 
			
		||||
  -webkit-transition: margin .25s ease-out;
 | 
			
		||||
  -moz-transition: margin .25s ease-out;
 | 
			
		||||
  -o-transition: margin .25s ease-out;
 | 
			
		||||
  transition: margin .25s ease-out;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#sidebar-wrapper .sidebar-heading {
 | 
			
		||||
  padding: 0.875rem 1.25rem;
 | 
			
		||||
  font-size: 1.2rem;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#sidebar-wrapper .list-group {
 | 
			
		||||
  width: 15rem;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#page-content-wrapper {
 | 
			
		||||
  min-width: 100vw;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#wrapper.toggled #sidebar-wrapper {
 | 
			
		||||
  margin-left: 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@media (min-width: 768px) {
 | 
			
		||||
  #sidebar-wrapper {
 | 
			
		||||
    margin-left: 0;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  #page-content-wrapper {
 | 
			
		||||
    min-width: 0;
 | 
			
		||||
    width: 100%;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  #wrapper.toggled #sidebar-wrapper {
 | 
			
		||||
    margin-left: -15rem;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										3904
									
								
								backend/multimail/static/vendor/bootstrap/css/bootstrap-grid.css
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										3904
									
								
								backend/multimail/static/vendor/bootstrap/css/bootstrap-grid.css
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							
							
								
								
									
										1
									
								
								backend/multimail/static/vendor/bootstrap/css/bootstrap-grid.css.map
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								backend/multimail/static/vendor/bootstrap/css/bootstrap-grid.css.map
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										7
									
								
								backend/multimail/static/vendor/bootstrap/css/bootstrap-grid.min.css
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								backend/multimail/static/vendor/bootstrap/css/bootstrap-grid.min.css
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										1
									
								
								backend/multimail/static/vendor/bootstrap/css/bootstrap-grid.min.css.map
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								backend/multimail/static/vendor/bootstrap/css/bootstrap-grid.min.css.map
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										325
									
								
								backend/multimail/static/vendor/bootstrap/css/bootstrap-reboot.css
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										325
									
								
								backend/multimail/static/vendor/bootstrap/css/bootstrap-reboot.css
									
										
									
									
										vendored
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,325 @@
 | 
			
		|||
/*!
 | 
			
		||||
 * Bootstrap Reboot v4.5.0 (https://getbootstrap.com/)
 | 
			
		||||
 * Copyright 2011-2020 The Bootstrap Authors
 | 
			
		||||
 * Copyright 2011-2020 Twitter, Inc.
 | 
			
		||||
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
 | 
			
		||||
 * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md)
 | 
			
		||||
 */
 | 
			
		||||
*,
 | 
			
		||||
*::before,
 | 
			
		||||
*::after {
 | 
			
		||||
  box-sizing: border-box;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
html {
 | 
			
		||||
  font-family: sans-serif;
 | 
			
		||||
  line-height: 1.15;
 | 
			
		||||
  -webkit-text-size-adjust: 100%;
 | 
			
		||||
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
article, aside, figcaption, figure, footer, header, hgroup, main, nav, section {
 | 
			
		||||
  display: block;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
body {
 | 
			
		||||
  margin: 0;
 | 
			
		||||
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
 | 
			
		||||
  font-size: 1rem;
 | 
			
		||||
  font-weight: 400;
 | 
			
		||||
  line-height: 1.5;
 | 
			
		||||
  color: #212529;
 | 
			
		||||
  text-align: left;
 | 
			
		||||
  background-color: #fff;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
[tabindex="-1"]:focus:not(:focus-visible) {
 | 
			
		||||
  outline: 0 !important;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
hr {
 | 
			
		||||
  box-sizing: content-box;
 | 
			
		||||
  height: 0;
 | 
			
		||||
  overflow: visible;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
h1, h2, h3, h4, h5, h6 {
 | 
			
		||||
  margin-top: 0;
 | 
			
		||||
  margin-bottom: 0.5rem;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
p {
 | 
			
		||||
  margin-top: 0;
 | 
			
		||||
  margin-bottom: 1rem;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
abbr[title],
 | 
			
		||||
abbr[data-original-title] {
 | 
			
		||||
  text-decoration: underline;
 | 
			
		||||
  -webkit-text-decoration: underline dotted;
 | 
			
		||||
  text-decoration: underline dotted;
 | 
			
		||||
  cursor: help;
 | 
			
		||||
  border-bottom: 0;
 | 
			
		||||
  -webkit-text-decoration-skip-ink: none;
 | 
			
		||||
  text-decoration-skip-ink: none;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
address {
 | 
			
		||||
  margin-bottom: 1rem;
 | 
			
		||||
  font-style: normal;
 | 
			
		||||
  line-height: inherit;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
ol,
 | 
			
		||||
ul,
 | 
			
		||||
dl {
 | 
			
		||||
  margin-top: 0;
 | 
			
		||||
  margin-bottom: 1rem;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
ol ol,
 | 
			
		||||
ul ul,
 | 
			
		||||
ol ul,
 | 
			
		||||
ul ol {
 | 
			
		||||
  margin-bottom: 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
dt {
 | 
			
		||||
  font-weight: 700;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
dd {
 | 
			
		||||
  margin-bottom: .5rem;
 | 
			
		||||
  margin-left: 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
blockquote {
 | 
			
		||||
  margin: 0 0 1rem;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
b,
 | 
			
		||||
strong {
 | 
			
		||||
  font-weight: bolder;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
small {
 | 
			
		||||
  font-size: 80%;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub,
 | 
			
		||||
sup {
 | 
			
		||||
  position: relative;
 | 
			
		||||
  font-size: 75%;
 | 
			
		||||
  line-height: 0;
 | 
			
		||||
  vertical-align: baseline;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub {
 | 
			
		||||
  bottom: -.25em;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sup {
 | 
			
		||||
  top: -.5em;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
a {
 | 
			
		||||
  color: #007bff;
 | 
			
		||||
  text-decoration: none;
 | 
			
		||||
  background-color: transparent;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
a:hover {
 | 
			
		||||
  color: #0056b3;
 | 
			
		||||
  text-decoration: underline;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
a:not([href]) {
 | 
			
		||||
  color: inherit;
 | 
			
		||||
  text-decoration: none;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
a:not([href]):hover {
 | 
			
		||||
  color: inherit;
 | 
			
		||||
  text-decoration: none;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
pre,
 | 
			
		||||
code,
 | 
			
		||||
kbd,
 | 
			
		||||
samp {
 | 
			
		||||
  font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
 | 
			
		||||
  font-size: 1em;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
pre {
 | 
			
		||||
  margin-top: 0;
 | 
			
		||||
  margin-bottom: 1rem;
 | 
			
		||||
  overflow: auto;
 | 
			
		||||
  -ms-overflow-style: scrollbar;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
figure {
 | 
			
		||||
  margin: 0 0 1rem;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
img {
 | 
			
		||||
  vertical-align: middle;
 | 
			
		||||
  border-style: none;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
svg {
 | 
			
		||||
  overflow: hidden;
 | 
			
		||||
  vertical-align: middle;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
table {
 | 
			
		||||
  border-collapse: collapse;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
caption {
 | 
			
		||||
  padding-top: 0.75rem;
 | 
			
		||||
  padding-bottom: 0.75rem;
 | 
			
		||||
  color: #6c757d;
 | 
			
		||||
  text-align: left;
 | 
			
		||||
  caption-side: bottom;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
th {
 | 
			
		||||
  text-align: inherit;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
label {
 | 
			
		||||
  display: inline-block;
 | 
			
		||||
  margin-bottom: 0.5rem;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
button {
 | 
			
		||||
  border-radius: 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
button:focus {
 | 
			
		||||
  outline: 1px dotted;
 | 
			
		||||
  outline: 5px auto -webkit-focus-ring-color;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
input,
 | 
			
		||||
button,
 | 
			
		||||
select,
 | 
			
		||||
optgroup,
 | 
			
		||||
textarea {
 | 
			
		||||
  margin: 0;
 | 
			
		||||
  font-family: inherit;
 | 
			
		||||
  font-size: inherit;
 | 
			
		||||
  line-height: inherit;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
button,
 | 
			
		||||
input {
 | 
			
		||||
  overflow: visible;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
button,
 | 
			
		||||
select {
 | 
			
		||||
  text-transform: none;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
[role="button"] {
 | 
			
		||||
  cursor: pointer;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
select {
 | 
			
		||||
  word-wrap: normal;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
button,
 | 
			
		||||
[type="button"],
 | 
			
		||||
[type="reset"],
 | 
			
		||||
[type="submit"] {
 | 
			
		||||
  -webkit-appearance: button;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
button:not(:disabled),
 | 
			
		||||
[type="button"]:not(:disabled),
 | 
			
		||||
[type="reset"]:not(:disabled),
 | 
			
		||||
[type="submit"]:not(:disabled) {
 | 
			
		||||
  cursor: pointer;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
button::-moz-focus-inner,
 | 
			
		||||
[type="button"]::-moz-focus-inner,
 | 
			
		||||
[type="reset"]::-moz-focus-inner,
 | 
			
		||||
[type="submit"]::-moz-focus-inner {
 | 
			
		||||
  padding: 0;
 | 
			
		||||
  border-style: none;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
input[type="radio"],
 | 
			
		||||
input[type="checkbox"] {
 | 
			
		||||
  box-sizing: border-box;
 | 
			
		||||
  padding: 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
textarea {
 | 
			
		||||
  overflow: auto;
 | 
			
		||||
  resize: vertical;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
fieldset {
 | 
			
		||||
  min-width: 0;
 | 
			
		||||
  padding: 0;
 | 
			
		||||
  margin: 0;
 | 
			
		||||
  border: 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
legend {
 | 
			
		||||
  display: block;
 | 
			
		||||
  width: 100%;
 | 
			
		||||
  max-width: 100%;
 | 
			
		||||
  padding: 0;
 | 
			
		||||
  margin-bottom: .5rem;
 | 
			
		||||
  font-size: 1.5rem;
 | 
			
		||||
  line-height: inherit;
 | 
			
		||||
  color: inherit;
 | 
			
		||||
  white-space: normal;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
progress {
 | 
			
		||||
  vertical-align: baseline;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
[type="number"]::-webkit-inner-spin-button,
 | 
			
		||||
[type="number"]::-webkit-outer-spin-button {
 | 
			
		||||
  height: auto;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
[type="search"] {
 | 
			
		||||
  outline-offset: -2px;
 | 
			
		||||
  -webkit-appearance: none;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
[type="search"]::-webkit-search-decoration {
 | 
			
		||||
  -webkit-appearance: none;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
::-webkit-file-upload-button {
 | 
			
		||||
  font: inherit;
 | 
			
		||||
  -webkit-appearance: button;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
output {
 | 
			
		||||
  display: inline-block;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
summary {
 | 
			
		||||
  display: list-item;
 | 
			
		||||
  cursor: pointer;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
template {
 | 
			
		||||
  display: none;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
[hidden] {
 | 
			
		||||
  display: none !important;
 | 
			
		||||
}
 | 
			
		||||
/*# sourceMappingURL=bootstrap-reboot.css.map */
 | 
			
		||||
							
								
								
									
										1
									
								
								backend/multimail/static/vendor/bootstrap/css/bootstrap-reboot.css.map
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								backend/multimail/static/vendor/bootstrap/css/bootstrap-reboot.css.map
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										8
									
								
								backend/multimail/static/vendor/bootstrap/css/bootstrap-reboot.min.css
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								backend/multimail/static/vendor/bootstrap/css/bootstrap-reboot.min.css
									
										
									
									
										vendored
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,8 @@
 | 
			
		|||
/*!
 | 
			
		||||
 * Bootstrap Reboot v4.5.0 (https://getbootstrap.com/)
 | 
			
		||||
 * Copyright 2011-2020 The Bootstrap Authors
 | 
			
		||||
 * Copyright 2011-2020 Twitter, Inc.
 | 
			
		||||
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
 | 
			
		||||
 * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md)
 | 
			
		||||
 */*,::after,::before{box-sizing:border-box}html{font-family:sans-serif;line-height:1.15;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}article,aside,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}body{margin:0;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;text-align:left;background-color:#fff}[tabindex="-1"]:focus:not(:focus-visible){outline:0!important}hr{box-sizing:content-box;height:0;overflow:visible}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem}p{margin-top:0;margin-bottom:1rem}abbr[data-original-title],abbr[title]{text-decoration:underline;-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;border-bottom:0;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:80%}sub,sup{position:relative;font-size:75%;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#007bff;text-decoration:none;background-color:transparent}a:hover{color:#0056b3;text-decoration:underline}a:not([href]){color:inherit;text-decoration:none}a:not([href]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em}pre{margin-top:0;margin-bottom:1rem;overflow:auto;-ms-overflow-style:scrollbar}figure{margin:0 0 1rem}img{vertical-align:middle;border-style:none}svg{overflow:hidden;vertical-align:middle}table{border-collapse:collapse}caption{padding-top:.75rem;padding-bottom:.75rem;color:#6c757d;text-align:left;caption-side:bottom}th{text-align:inherit}label{display:inline-block;margin-bottom:.5rem}button{border-radius:0}button:focus{outline:1px dotted;outline:5px auto -webkit-focus-ring-color}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,input{overflow:visible}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner{padding:0;border-style:none}input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0}textarea{overflow:auto;resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{display:block;width:100%;max-width:100%;padding:0;margin-bottom:.5rem;font-size:1.5rem;line-height:inherit;color:inherit;white-space:normal}progress{vertical-align:baseline}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:none}[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}summary{display:list-item;cursor:pointer}template{display:none}[hidden]{display:none!important}
 | 
			
		||||
/*# sourceMappingURL=bootstrap-reboot.min.css.map */
 | 
			
		||||
							
								
								
									
										1
									
								
								backend/multimail/static/vendor/bootstrap/css/bootstrap-reboot.min.css.map
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								backend/multimail/static/vendor/bootstrap/css/bootstrap-reboot.min.css.map
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										10278
									
								
								backend/multimail/static/vendor/bootstrap/css/bootstrap.css
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										10278
									
								
								backend/multimail/static/vendor/bootstrap/css/bootstrap.css
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							
							
								
								
									
										1
									
								
								backend/multimail/static/vendor/bootstrap/css/bootstrap.css.map
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								backend/multimail/static/vendor/bootstrap/css/bootstrap.css.map
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										7
									
								
								backend/multimail/static/vendor/bootstrap/css/bootstrap.min.css
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								backend/multimail/static/vendor/bootstrap/css/bootstrap.min.css
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										1
									
								
								backend/multimail/static/vendor/bootstrap/css/bootstrap.min.css.map
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								backend/multimail/static/vendor/bootstrap/css/bootstrap.min.css.map
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										7033
									
								
								backend/multimail/static/vendor/bootstrap/js/bootstrap.bundle.js
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										7033
									
								
								backend/multimail/static/vendor/bootstrap/js/bootstrap.bundle.js
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							
							
								
								
									
										1
									
								
								backend/multimail/static/vendor/bootstrap/js/bootstrap.bundle.js.map
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								backend/multimail/static/vendor/bootstrap/js/bootstrap.bundle.js.map
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										7
									
								
								backend/multimail/static/vendor/bootstrap/js/bootstrap.bundle.min.js
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								backend/multimail/static/vendor/bootstrap/js/bootstrap.bundle.min.js
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										1
									
								
								backend/multimail/static/vendor/bootstrap/js/bootstrap.bundle.min.js.map
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								backend/multimail/static/vendor/bootstrap/js/bootstrap.bundle.min.js.map
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										4420
									
								
								backend/multimail/static/vendor/bootstrap/js/bootstrap.js
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										4420
									
								
								backend/multimail/static/vendor/bootstrap/js/bootstrap.js
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							
							
								
								
									
										1
									
								
								backend/multimail/static/vendor/bootstrap/js/bootstrap.js.map
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								backend/multimail/static/vendor/bootstrap/js/bootstrap.js.map
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										7
									
								
								backend/multimail/static/vendor/bootstrap/js/bootstrap.min.js
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								backend/multimail/static/vendor/bootstrap/js/bootstrap.min.js
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										1
									
								
								backend/multimail/static/vendor/bootstrap/js/bootstrap.min.js.map
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								backend/multimail/static/vendor/bootstrap/js/bootstrap.min.js.map
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										10872
									
								
								backend/multimail/static/vendor/jquery/jquery.js
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										10872
									
								
								backend/multimail/static/vendor/jquery/jquery.js
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							
							
								
								
									
										2
									
								
								backend/multimail/static/vendor/jquery/jquery.min.js
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								backend/multimail/static/vendor/jquery/jquery.min.js
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										1
									
								
								backend/multimail/static/vendor/jquery/jquery.min.map
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								backend/multimail/static/vendor/jquery/jquery.min.map
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										8777
									
								
								backend/multimail/static/vendor/jquery/jquery.slim.js
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										8777
									
								
								backend/multimail/static/vendor/jquery/jquery.slim.js
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							
							
								
								
									
										2
									
								
								backend/multimail/static/vendor/jquery/jquery.slim.min.js
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								backend/multimail/static/vendor/jquery/jquery.slim.min.js
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										1
									
								
								backend/multimail/static/vendor/jquery/jquery.slim.min.map
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								backend/multimail/static/vendor/jquery/jquery.slim.min.map
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										95
									
								
								backend/multimail/templates/multimail/base.html
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										95
									
								
								backend/multimail/templates/multimail/base.html
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,95 @@
 | 
			
		|||
{% load static %}
 | 
			
		||||
<!DOCTYPE html>
 | 
			
		||||
<html lang="en">
 | 
			
		||||
 | 
			
		||||
<head>
 | 
			
		||||
 | 
			
		||||
    <meta charset="utf-8">
 | 
			
		||||
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
 | 
			
		||||
    <meta name="description" content="">
 | 
			
		||||
    <meta name="author" content="">
 | 
			
		||||
 | 
			
		||||
    <title>Multimail</title>
 | 
			
		||||
 | 
			
		||||
    <!-- Bootstrap core CSS -->
 | 
			
		||||
    <link href="{% static 'vendor/bootstrap/css/bootstrap.min.css' %}" rel="stylesheet">
 | 
			
		||||
 | 
			
		||||
    <!-- Custom styles for this template -->
 | 
			
		||||
    <link href="{% static 'multimail/css/simple-sidebar.css' %}" rel="stylesheet">
 | 
			
		||||
 | 
			
		||||
</head>
 | 
			
		||||
 | 
			
		||||
<body>
 | 
			
		||||
 | 
			
		||||
<div class="d-flex" id="wrapper">
 | 
			
		||||
 | 
			
		||||
    <!-- Sidebar -->
 | 
			
		||||
    <div class="bg-light border-right" id="sidebar-wrapper">
 | 
			
		||||
        <div class="sidebar-heading">Multimail</div>
 | 
			
		||||
        <div class="list-group list-group-flush">
 | 
			
		||||
            <a href="{% url 'multimail:domains' %}" class="list-group-item list-group-item-action bg-light">Domains</a>
 | 
			
		||||
            <a href="{% url 'multimail:mailboxes' %}" class="list-group-item list-group-item-action bg-light">Mailboxes</a>
 | 
			
		||||
            <a href="#" class="list-group-item list-group-item-action bg-light">Aliases</a>
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
    <!-- /#sidebar-wrapper -->
 | 
			
		||||
 | 
			
		||||
    <!-- Page Content -->
 | 
			
		||||
    <div id="page-content-wrapper">
 | 
			
		||||
 | 
			
		||||
        <nav class="navbar navbar-expand-lg navbar-light bg-light border-bottom">
 | 
			
		||||
            <button class="btn btn-primary" id="menu-toggle">Toggle Menu</button>
 | 
			
		||||
 | 
			
		||||
            <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent"
 | 
			
		||||
                    aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
 | 
			
		||||
                <span class="navbar-toggler-icon"></span>
 | 
			
		||||
            </button>
 | 
			
		||||
 | 
			
		||||
            <div class="collapse navbar-collapse" id="navbarSupportedContent">
 | 
			
		||||
                <ul class="navbar-nav ml-auto mt-2 mt-lg-0">
 | 
			
		||||
                    <li class="nav-item active">
 | 
			
		||||
                        <a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
 | 
			
		||||
                    </li>
 | 
			
		||||
                    <li class="nav-item">
 | 
			
		||||
                        <a class="nav-link" href="#">Link</a>
 | 
			
		||||
                    </li>
 | 
			
		||||
                    <li class="nav-item dropdown">
 | 
			
		||||
                        <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button"
 | 
			
		||||
                           data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
 | 
			
		||||
                            {{user}}
 | 
			
		||||
                        </a>
 | 
			
		||||
                        <div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdown">
 | 
			
		||||
                            <a class="dropdown-item" href="#">Nothing</a>
 | 
			
		||||
                            <div class="dropdown-divider"></div>
 | 
			
		||||
                            <a href="{% url 'multimail:logout' %}" class="dropdown-item">Logout</a>
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </li>
 | 
			
		||||
                </ul>
 | 
			
		||||
            </div>
 | 
			
		||||
        </nav>
 | 
			
		||||
 | 
			
		||||
        <div class="container-fluid">
 | 
			
		||||
            {% block content %}
 | 
			
		||||
            {% endblock %}
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
    <!-- /#page-content-wrapper -->
 | 
			
		||||
 | 
			
		||||
</div>
 | 
			
		||||
<!-- /#wrapper -->
 | 
			
		||||
 | 
			
		||||
<!-- Bootstrap core JavaScript -->
 | 
			
		||||
<script src="{% static 'vendor/jquery/jquery.slim.min.js' %}"></script>
 | 
			
		||||
<script src="{% static   'vendor/bootstrap/js/bootstrap.bundle.min.js' %}"></script>
 | 
			
		||||
 | 
			
		||||
<!-- Menu Toggle Script -->
 | 
			
		||||
<script>
 | 
			
		||||
    $("#menu-toggle").click(function (e) {
 | 
			
		||||
        e.preventDefault();
 | 
			
		||||
        $("#wrapper").toggleClass("toggled");
 | 
			
		||||
    });
 | 
			
		||||
</script>
 | 
			
		||||
 | 
			
		||||
</body>
 | 
			
		||||
 | 
			
		||||
</html>
 | 
			
		||||
							
								
								
									
										12
									
								
								backend/multimail/templates/multimail/detail.html
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								backend/multimail/templates/multimail/detail.html
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,12 @@
 | 
			
		|||
<h1>{{ question.question_text }}</h1>
 | 
			
		||||
 | 
			
		||||
{% if error_message %}<p><strong>{{ error_message }}</strong></p>{% endif %}
 | 
			
		||||
 | 
			
		||||
<form action="{% url 'multimail:vote' question.id %}" method="post">
 | 
			
		||||
{% csrf_token %}
 | 
			
		||||
{% for choice in question.choice_set.all %}
 | 
			
		||||
    <input type="radio" name="choice" id="choice{{ forloop.counter }}" value="{{ choice.id }}">
 | 
			
		||||
    <label for="choice{{ forloop.counter }}">{{ choice.choice_text }}</label><br>
 | 
			
		||||
{% endfor %}
 | 
			
		||||
<input type="submit" value="Vote">
 | 
			
		||||
</form>
 | 
			
		||||
							
								
								
									
										16
									
								
								backend/multimail/templates/multimail/domains.html
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								backend/multimail/templates/multimail/domains.html
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,16 @@
 | 
			
		|||
{% extends 'multimail/base.html' %}
 | 
			
		||||
 | 
			
		||||
{% block content %}
 | 
			
		||||
    <h1 class="mt-4">Domains</h1>
 | 
			
		||||
 | 
			
		||||
    {% if domain_list %}
 | 
			
		||||
        <ul>
 | 
			
		||||
            {% for question in domain_list %}
 | 
			
		||||
                <li><a href="{% url 'multimail:detail' question.id %}">{{ question.domain }}</a></li>
 | 
			
		||||
            {% endfor %}
 | 
			
		||||
        </ul>
 | 
			
		||||
    {% else %}
 | 
			
		||||
        <p>No multimail are available.</p>
 | 
			
		||||
    {% endif %}
 | 
			
		||||
 | 
			
		||||
{% endblock %}
 | 
			
		||||
							
								
								
									
										16
									
								
								backend/multimail/templates/multimail/index.html
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								backend/multimail/templates/multimail/index.html
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,16 @@
 | 
			
		|||
{% extends 'multimail/base.html' %}
 | 
			
		||||
 | 
			
		||||
{% block content %}
 | 
			
		||||
    <h1 class="mt-4">Domains</h1>
 | 
			
		||||
 | 
			
		||||
    {% if domain_list %}
 | 
			
		||||
        <ul>
 | 
			
		||||
            {% for question in domain_list %}
 | 
			
		||||
                <li><a href="{% url 'multimail:detail' question.id %}">{{ question.domain }}</a></li>
 | 
			
		||||
            {% endfor %}
 | 
			
		||||
        </ul>
 | 
			
		||||
    {% else %}
 | 
			
		||||
        <p>No multimail are available.</p>
 | 
			
		||||
    {% endif %}
 | 
			
		||||
 | 
			
		||||
{% endblock %}
 | 
			
		||||
							
								
								
									
										16
									
								
								backend/multimail/templates/multimail/mailboxes.html
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								backend/multimail/templates/multimail/mailboxes.html
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,16 @@
 | 
			
		|||
{% extends 'multimail/base.html' %}
 | 
			
		||||
 | 
			
		||||
{% block content %}
 | 
			
		||||
    <h1 class="mt-4">Mailboxes</h1>
 | 
			
		||||
 | 
			
		||||
    {% if mailbox_list %}
 | 
			
		||||
        <ul>
 | 
			
		||||
            {% for question in mailbox_list %}
 | 
			
		||||
                <li><a href="{% url 'multimail:detail' question.id %}">{{ question.domain }}</a></li>
 | 
			
		||||
            {% endfor %}
 | 
			
		||||
        </ul>
 | 
			
		||||
    {% else %}
 | 
			
		||||
        <p>No multimail are available.</p>
 | 
			
		||||
    {% endif %}
 | 
			
		||||
 | 
			
		||||
{% endblock %}
 | 
			
		||||
							
								
								
									
										9
									
								
								backend/multimail/templates/multimail/results.html
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								backend/multimail/templates/multimail/results.html
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,9 @@
 | 
			
		|||
<h1>{{ question.question_text }}</h1>
 | 
			
		||||
 | 
			
		||||
<ul>
 | 
			
		||||
{% for choice in question.choice_set.all %}
 | 
			
		||||
    <li>{{ choice.choice_text }} -- {{ choice.votes }} vote{{ choice.votes|pluralize }}</li>
 | 
			
		||||
{% endfor %}
 | 
			
		||||
</ul>
 | 
			
		||||
 | 
			
		||||
<a href="{% url 'multimail:detail' question.id %}">Vote again?</a>
 | 
			
		||||
							
								
								
									
										6
									
								
								backend/multimail/templates/registration/login.html
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								backend/multimail/templates/registration/login.html
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,6 @@
 | 
			
		|||
<h2>Log In</h2>
 | 
			
		||||
<form method="post">
 | 
			
		||||
  {% csrf_token %}
 | 
			
		||||
  {{ form.as_p }}
 | 
			
		||||
  <button type="submit">Log In</button>
 | 
			
		||||
</form>
 | 
			
		||||
							
								
								
									
										126
									
								
								backend/multimail/tests.py
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										126
									
								
								backend/multimail/tests.py
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,126 @@
 | 
			
		|||
import datetime
 | 
			
		||||
from django.urls import reverse
 | 
			
		||||
from django.test import TestCase
 | 
			
		||||
from django.utils import timezone
 | 
			
		||||
 | 
			
		||||
from .models import Question
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class QuestionModelTests(TestCase):
 | 
			
		||||
 | 
			
		||||
    def test_was_published_recently_with_future_question(self):
 | 
			
		||||
        """
 | 
			
		||||
        was_published_recently() returns False for questions whose pub_date
 | 
			
		||||
        is in the future.
 | 
			
		||||
        """
 | 
			
		||||
        time = timezone.now() + datetime.timedelta(days=30)
 | 
			
		||||
        future_question = Question(pub_date=time)
 | 
			
		||||
        self.assertIs(future_question.was_published_recently(), False)
 | 
			
		||||
 | 
			
		||||
    def test_was_published_recently_with_old_question(self):
 | 
			
		||||
        """
 | 
			
		||||
        was_published_recently() returns False for questions whose pub_date
 | 
			
		||||
        is older than 1 day.
 | 
			
		||||
        """
 | 
			
		||||
        time = timezone.now() - datetime.timedelta(days=1, seconds=1)
 | 
			
		||||
        old_question = Question(pub_date=time)
 | 
			
		||||
        self.assertIs(old_question.was_published_recently(), False)
 | 
			
		||||
 | 
			
		||||
    def test_was_published_recently_with_recent_question(self):
 | 
			
		||||
        """
 | 
			
		||||
        was_published_recently() returns True for questions whose pub_date
 | 
			
		||||
        is within the last day.
 | 
			
		||||
        """
 | 
			
		||||
        time = timezone.now() - datetime.timedelta(hours=23, minutes=59, seconds=59)
 | 
			
		||||
        recent_question = Question(pub_date=time)
 | 
			
		||||
        self.assertIs(recent_question.was_published_recently(), True)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def create_question(question_text, days):
 | 
			
		||||
    """
 | 
			
		||||
    Create a question with the given `question_text` and published the
 | 
			
		||||
    given number of `days` offset to now (negative for questions published
 | 
			
		||||
    in the past, positive for questions that have yet to be published).
 | 
			
		||||
    """
 | 
			
		||||
    time = timezone.now() + datetime.timedelta(days=days)
 | 
			
		||||
    return Question.objects.create(question_text=question_text, pub_date=time)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class QuestionIndexViewTests(TestCase):
 | 
			
		||||
    def test_no_questions(self):
 | 
			
		||||
        """
 | 
			
		||||
        If no questions exist, an appropriate message is displayed.
 | 
			
		||||
        """
 | 
			
		||||
        response = self.client.get(reverse('multimail:index'))
 | 
			
		||||
        self.assertEqual(response.status_code, 200)
 | 
			
		||||
        self.assertContains(response, "No multimail are available.")
 | 
			
		||||
        self.assertQuerysetEqual(response.context['latest_question_list'], [])
 | 
			
		||||
 | 
			
		||||
    def test_past_question(self):
 | 
			
		||||
        """
 | 
			
		||||
        Questions with a pub_date in the past are displayed on the
 | 
			
		||||
        index page.
 | 
			
		||||
        """
 | 
			
		||||
        create_question(question_text="Past question.", days=-30)
 | 
			
		||||
        response = self.client.get(reverse('multimail:index'))
 | 
			
		||||
        self.assertQuerysetEqual(
 | 
			
		||||
            response.context['latest_question_list'],
 | 
			
		||||
            ['<Question: Past question.>']
 | 
			
		||||
        )
 | 
			
		||||
 | 
			
		||||
    def test_future_question(self):
 | 
			
		||||
        """
 | 
			
		||||
        Questions with a pub_date in the future aren't displayed on
 | 
			
		||||
        the index page.
 | 
			
		||||
        """
 | 
			
		||||
        create_question(question_text="Future question.", days=30)
 | 
			
		||||
        response = self.client.get(reverse('multimail:index'))
 | 
			
		||||
        self.assertContains(response, "No multimail are available.")
 | 
			
		||||
        self.assertQuerysetEqual(response.context['latest_question_list'], [])
 | 
			
		||||
 | 
			
		||||
    def test_future_question_and_past_question(self):
 | 
			
		||||
        """
 | 
			
		||||
        Even if both past and future questions exist, only past questions
 | 
			
		||||
        are displayed.
 | 
			
		||||
        """
 | 
			
		||||
        create_question(question_text="Past question.", days=-30)
 | 
			
		||||
        create_question(question_text="Future question.", days=30)
 | 
			
		||||
        response = self.client.get(reverse('multimail:index'))
 | 
			
		||||
        self.assertQuerysetEqual(
 | 
			
		||||
            response.context['latest_question_list'],
 | 
			
		||||
            ['<Question: Past question.>']
 | 
			
		||||
        )
 | 
			
		||||
 | 
			
		||||
    def test_two_past_questions(self):
 | 
			
		||||
        """
 | 
			
		||||
        The questions index page may display multiple questions.
 | 
			
		||||
        """
 | 
			
		||||
        create_question(question_text="Past question 1.", days=-30)
 | 
			
		||||
        create_question(question_text="Past question 2.", days=-5)
 | 
			
		||||
        response = self.client.get(reverse('multimail:index'))
 | 
			
		||||
        self.assertQuerysetEqual(
 | 
			
		||||
            response.context['latest_question_list'],
 | 
			
		||||
            ['<Question: Past question 2.>', '<Question: Past question 1.>']
 | 
			
		||||
        )
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class QuestionDetailViewTests(TestCase):
 | 
			
		||||
    def test_future_question(self):
 | 
			
		||||
        """
 | 
			
		||||
        The detail view of a question with a pub_date in the future
 | 
			
		||||
        returns a 404 not found.
 | 
			
		||||
        """
 | 
			
		||||
        future_question = create_question(question_text='Future question.', days=5)
 | 
			
		||||
        url = reverse('multimail:detail', args=(future_question.id,))
 | 
			
		||||
        response = self.client.get(url)
 | 
			
		||||
        self.assertEqual(response.status_code, 404)
 | 
			
		||||
 | 
			
		||||
    def test_past_question(self):
 | 
			
		||||
        """
 | 
			
		||||
        The detail view of a question with a pub_date in the past
 | 
			
		||||
        displays the question's text.
 | 
			
		||||
        """
 | 
			
		||||
        past_question = create_question(question_text='Past Question.', days=-5)
 | 
			
		||||
        url = reverse('multimail:detail', args=(past_question.id,))
 | 
			
		||||
        response = self.client.get(url)
 | 
			
		||||
        self.assertContains(response, past_question.question_text)
 | 
			
		||||
							
								
								
									
										17
									
								
								backend/multimail/urls.py
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								backend/multimail/urls.py
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,17 @@
 | 
			
		|||
from django.urls import path
 | 
			
		||||
from django.contrib.auth import views as auth_views
 | 
			
		||||
 | 
			
		||||
from . import views
 | 
			
		||||
from . import actions
 | 
			
		||||
 | 
			
		||||
app_name = 'multimail'
 | 
			
		||||
urlpatterns = [
 | 
			
		||||
    path('', views.DomainListView.as_view(), name='index'),
 | 
			
		||||
    path('domains/', views.DomainListView.as_view(), name='domains'),
 | 
			
		||||
    path('mailboxes/', views.MailboxListView.as_view(), name='mailboxes'),
 | 
			
		||||
    path('<int:pk>/', views.DetailView.as_view(), name='detail'),
 | 
			
		||||
    path('<int:pk>/results/', views.ResultsView.as_view(), name='results'),
 | 
			
		||||
    path('<int:question_id>/vote/', actions.vote, name='vote'),
 | 
			
		||||
    path('login/', auth_views.LoginView.as_view(), name='login'),
 | 
			
		||||
    path('logout/', auth_views.LogoutView.as_view(), name='logout'),
 | 
			
		||||
]
 | 
			
		||||
							
								
								
									
										57
									
								
								backend/multimail/views.py
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										57
									
								
								backend/multimail/views.py
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,57 @@
 | 
			
		|||
from django.http import HttpResponseRedirect
 | 
			
		||||
from django.shortcuts import get_object_or_404, render
 | 
			
		||||
from django.urls import reverse
 | 
			
		||||
from django.views import generic
 | 
			
		||||
from django.utils import timezone
 | 
			
		||||
from django.contrib.auth.decorators import login_required
 | 
			
		||||
from django.contrib.auth.mixins import LoginRequiredMixin
 | 
			
		||||
 | 
			
		||||
from .models import Choice, Question, Domain, Mailbox
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class DomainListView(LoginRequiredMixin, generic.ListView):
 | 
			
		||||
    login_url = 'login/'
 | 
			
		||||
    # redirect_field_name = 'redirect_to'
 | 
			
		||||
    template_name = 'multimail/domains.html'
 | 
			
		||||
    context_object_name = 'domain_list'
 | 
			
		||||
 | 
			
		||||
    def get_queryset(self):
 | 
			
		||||
        print(self.request.user)
 | 
			
		||||
        """Return the last five published questions."""
 | 
			
		||||
        #return Domain.objects.filter(
 | 
			
		||||
        #    pub_date__lte=timezone.now()
 | 
			
		||||
        #).order_by('-pub_date')[:5]
 | 
			
		||||
        return Domain.objects.all()
 | 
			
		||||
 | 
			
		||||
class MailboxListView(LoginRequiredMixin, generic.ListView):
 | 
			
		||||
    login_url = 'login/'
 | 
			
		||||
    # redirect_field_name = 'redirect_to'
 | 
			
		||||
    template_name = 'multimail/mailboxes.html'
 | 
			
		||||
    context_object_name = 'mailbox_list'
 | 
			
		||||
 | 
			
		||||
    def get_queryset(self):
 | 
			
		||||
        print(self.request.user)
 | 
			
		||||
        """Return the last five published questions."""
 | 
			
		||||
        #return Domain.objects.filter(
 | 
			
		||||
        #    pub_date__lte=timezone.now()
 | 
			
		||||
        #).order_by('-pub_date')[:5]
 | 
			
		||||
        return Mailbox.objects.all()
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class DetailView(LoginRequiredMixin, generic.DetailView):
 | 
			
		||||
    login_url = 'login/'
 | 
			
		||||
    model = Question
 | 
			
		||||
    template_name = 'multimail/detail.html'
 | 
			
		||||
 | 
			
		||||
    def get_queryset(self):
 | 
			
		||||
        """
 | 
			
		||||
        Excludes any questions that aren't published yet.
 | 
			
		||||
        """
 | 
			
		||||
        return Question.objects.filter(pub_date__lte=timezone.now())
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class ResultsView(LoginRequiredMixin, generic.DetailView):
 | 
			
		||||
    login_url = 'login/'
 | 
			
		||||
    model = Question
 | 
			
		||||
    template_name = 'multimail/results.html'
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue