├── .gitignore ├── LICENSE ├── README.md ├── deductivereasoning ├── accounts │ ├── __init__.py │ ├── admin.py │ ├── apps.py │ ├── forms.py │ ├── migrations │ │ └── __init__.py │ ├── models.py │ ├── tests.py │ └── views.py ├── comments │ ├── __init__.py │ ├── admin.py │ ├── apps.py │ ├── forms.py │ ├── migrations │ │ ├── 0001_initial.py │ │ └── __init__.py │ ├── models.py │ └── tests.py ├── deductivereasoning │ ├── __init__.py │ ├── settings.py │ ├── urls.py │ └── wsgi.py ├── manage.py ├── proofs │ ├── __init__.py │ ├── admin.py │ ├── apps.py │ ├── forms.py │ ├── migrations │ │ ├── 0001_initial.py │ │ ├── 0002_proof_form_type.py │ │ └── __init__.py │ ├── models.py │ ├── tests.py │ └── views.py ├── static │ ├── facebook.png │ ├── favicon.ico │ ├── github.png │ ├── js │ │ └── submit.js │ ├── layout │ │ └── styles │ │ │ ├── base.css │ │ │ └── reset.css │ ├── logo.png │ └── twitter.png └── templates │ ├── about.html │ ├── accounts │ ├── dashboard.html │ └── profile.html │ ├── base.html │ ├── home.html │ ├── proposition_detail.html │ ├── registration │ ├── login.html │ └── signup.html │ └── submit.html └── requirements.txt /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | .idea 6 | *.so 7 | 8 | # Distribution / packaging 9 | .Python 10 | build/ 11 | develop-eggs/ 12 | dist/ 13 | downloads/ 14 | eggs/ 15 | .eggs/ 16 | lib/ 17 | lib64/ 18 | parts/ 19 | sdist/ 20 | var/ 21 | wheels/ 22 | *.egg-info/ 23 | .installed.cfg 24 | *.egg 25 | MANIFEST 26 | 27 | # PyInstaller 28 | # Usually these files are written by a python script from a template 29 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 30 | *.manifest 31 | *.spec 32 | 33 | # Installer logs 34 | pip-log.txt 35 | pip-delete-this-directory.txt 36 | 37 | # Unit test / coverage reports 38 | htmlcov/ 39 | .tox/ 40 | .coverage 41 | .coverage.* 42 | .cache 43 | nosetests.xml 44 | coverage.xml 45 | *.cover 46 | .hypothesis/ 47 | .pytest_cache/ 48 | 49 | # Translations 50 | *.pot 51 | 52 | # Django stuff: 53 | *.log 54 | local_settings.py 55 | db.sqlite3 56 | 57 | # Flask stuff: 58 | instance/ 59 | .webassets-cache 60 | 61 | # Scrapy stuff: 62 | .scrapy 63 | 64 | # Sphinx documentation 65 | docs/_build/ 66 | 67 | # PyBuilder 68 | target/ 69 | 70 | # Jupyter Notebook 71 | .ipynb_checkpoints 72 | 73 | # pyenv 74 | .python-version 75 | 76 | # celery beat schedule file 77 | celerybeat-schedule 78 | 79 | # SageMath parsed files 80 | *.sage.py 81 | 82 | # Environments 83 | .env 84 | .venv 85 | env/ 86 | venv/ 87 | ENV/ 88 | env.bak/ 89 | venv.bak/ 90 | 91 | # Spyder project settings 92 | .spyderproject 93 | .spyproject 94 | 95 | # Rope project settings 96 | .ropeproject 97 | 98 | # mkdocs documentation 99 | /site 100 | 101 | # mypy 102 | .mypy_cache/ 103 | 104 | .DS_Store 105 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 lyk2018-python 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # deductive-reasoning 2 | A tool for deductive reasoning 3 | 4 | [Deductive Reasoning Web Site](http://142.93.138.235) 5 | 6 | 7 | ## Virtualenv Kurulumu 8 | pip install virtualenv 9 | 10 | ## Virtualenv Kullanımı 11 | 12 | virtualenv --python=python3 13 | 14 | __Virtualenv aktif etme işlemi__ 15 | 16 | source /bin/activate 17 | 18 | ## Gereksinim Kurulumu 19 | 20 | pip install -r requirement.txt 21 | 22 | ## Repo klonlanması 23 | __Proje için klasör açılır ardından;__ 24 | 25 | git clone https://github.com/lyk2018-python/deductive-reasoning.git 26 | 27 | ## *local_settings.py* eklenmesi 28 | __Proje clone landıktan sonra *settings.py* ın bulunduğu dizine (*../deductive-reasoning/deductivereasoning/deductivereasoning*) *local_settings.py* dosyası oluşturulur. Ardından içerisine şu kod bloğu eklenir__ 29 | ```python 30 | SECRET_KEY = 'SECRET-KEY-BURAYA' 31 | ALLOWED_HOSTS = [] 32 | DEBUG = True 33 | import os 34 | BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 35 | DATABASES = { 36 | 'default': { 37 | 'ENGINE': 'django.db.backends.sqlite3', 38 | 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), 39 | } 40 | } 41 | ``` 42 | __Daha sonra *SECRET-KEY-BURAYA* yazan alana şu linkten alınan Django Secret Keyi tırnak içerisine eklenir;__ 43 | 44 | [Django Secret Key Generator](https://www.miniwebtool.com/django-secret-key-generator/) 45 | 46 | ## Database İşlemleri 47 | 48 | __Bu işlemleri yapmak için manage.py dosyası ile aynı dosyada olmanız gerekiyor.__ 49 | 50 | cd deductive-reasoning/deductivereasoning 51 | python manage.py makemigrations 52 | python manage.py migrate 53 | 54 | ## Uygulamayı Çalıştırma 55 | 56 | python manage.py runserver 57 | 58 | __127.0.0.1:8000 adresi ile web browserdan kullanabilirsiniz.__ 59 | -------------------------------------------------------------------------------- /deductivereasoning/accounts/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lyk2018-python/deductive-reasoning/bf3d2c5ce458c27fb3e3e2d9bf52dbfebed52868/deductivereasoning/accounts/__init__.py -------------------------------------------------------------------------------- /deductivereasoning/accounts/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /deductivereasoning/accounts/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class AccountsConfig(AppConfig): 5 | name = 'accounts' 6 | -------------------------------------------------------------------------------- /deductivereasoning/accounts/forms.py: -------------------------------------------------------------------------------- 1 | from django.contrib.auth.forms import UserCreationForm 2 | from django.contrib.auth.models import User 3 | from django import forms 4 | from django.core.exceptions import ValidationError 5 | 6 | 7 | class CustomUserCreationForm(forms.Form): 8 | 9 | first_name = forms.CharField(label='Enter First Name', max_length=150) 10 | last_name = forms.CharField(label='Enter Last Name', max_length=150) 11 | username = forms.CharField(label='Enter Username', min_length=4, max_length=150) 12 | email = forms.EmailField(label='Enter email') 13 | password1 = forms.CharField(label='Enter password', widget=forms.PasswordInput) 14 | password2 = forms.CharField(label='Confirm password', widget=forms.PasswordInput) 15 | 16 | def clean_first_name(self): 17 | first_name = self.cleaned_data['first_name'].lower() 18 | return first_name 19 | 20 | def clean_last_name(self): 21 | last_name = self.cleaned_data['last_name'].lower() 22 | return last_name 23 | 24 | def clean_username(self): 25 | username = self.cleaned_data['username'].lower() 26 | r = User.objects.filter(username=username) 27 | if r.count(): 28 | raise ValidationError("Username already exists") 29 | return username 30 | 31 | def clean_email(self): 32 | email = self.cleaned_data['email'].lower() 33 | r = User.objects.filter(email=email) 34 | if r.count(): 35 | raise ValidationError("Email already exists") 36 | return email 37 | 38 | def clean_password2(self): 39 | password1 = self.cleaned_data.get('password1') 40 | password2 = self.cleaned_data.get('password2') 41 | 42 | if password1 and password2 and password1 != password2: 43 | raise ValidationError("Password don't match") 44 | return password2 45 | 46 | def save(self, commit=True): 47 | user = User.objects.create_user( 48 | self.cleaned_data['username'], 49 | first_name=self.cleaned_data['first_name'], 50 | last_name=self.cleaned_data['last_name'], 51 | email=self.cleaned_data['email'], 52 | password=self.cleaned_data['password1'] 53 | ) 54 | return user 55 | -------------------------------------------------------------------------------- /deductivereasoning/accounts/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lyk2018-python/deductive-reasoning/bf3d2c5ce458c27fb3e3e2d9bf52dbfebed52868/deductivereasoning/accounts/migrations/__init__.py -------------------------------------------------------------------------------- /deductivereasoning/accounts/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | # Create your models here. 4 | -------------------------------------------------------------------------------- /deductivereasoning/accounts/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /deductivereasoning/accounts/views.py: -------------------------------------------------------------------------------- 1 | from django.contrib.auth import login, authenticate 2 | from django.shortcuts import render, redirect 3 | from django.contrib.auth.forms import UserCreationForm 4 | from django.contrib.auth.models import User 5 | from .forms import CustomUserCreationForm 6 | from django.contrib import messages 7 | from proofs.models import * 8 | 9 | 10 | def signup(request): 11 | if request.method == 'POST': 12 | form = CustomUserCreationForm(request.POST) 13 | if form.is_valid(): 14 | form.save() 15 | user = authenticate(username=form.cleaned_data['username'], password=form.cleaned_data['password1']) 16 | login(request, user) 17 | return redirect('home') 18 | else: 19 | form = CustomUserCreationForm() 20 | return render(request, 'registration/signup.html', {'form': form}) 21 | 22 | def profile(request, username): 23 | user = User.objects.get(username=username) 24 | proofs = Proof.objects.all(); 25 | num_of_concs = 0 26 | for i in range(len(proofs)): 27 | if proofs[i].minor.user == user: 28 | num_of_concs += 1 29 | return render(request, 'accounts/profile.html', { 30 | 'user': user, 31 | 'numOfConcs': num_of_concs, 32 | }) 33 | 34 | def dashboard(request): 35 | return render(request, 'accounts/dashboard.html', {'title': 'Profile Page'}) 36 | -------------------------------------------------------------------------------- /deductivereasoning/comments/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lyk2018-python/deductive-reasoning/bf3d2c5ce458c27fb3e3e2d9bf52dbfebed52868/deductivereasoning/comments/__init__.py -------------------------------------------------------------------------------- /deductivereasoning/comments/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | from .models import * 3 | admin.site.register(Comment) 4 | # Register your models here. 5 | -------------------------------------------------------------------------------- /deductivereasoning/comments/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class CommentsConfig(AppConfig): 5 | name = 'Comments' 6 | -------------------------------------------------------------------------------- /deductivereasoning/comments/forms.py: -------------------------------------------------------------------------------- 1 | from django import forms 2 | from .models import Comment 3 | 4 | class CommentForm(forms.ModelForm): 5 | class Meta: 6 | model = Comment 7 | fields = ('text',) -------------------------------------------------------------------------------- /deductivereasoning/comments/migrations/0001_initial.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.0.7 on 2018-08-03 15:29 2 | 3 | from django.conf import settings 4 | from django.db import migrations, models 5 | import django.db.models.deletion 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | initial = True 11 | 12 | dependencies = [ 13 | ('proofs', '0001_initial'), 14 | migrations.swappable_dependency(settings.AUTH_USER_MODEL), 15 | ] 16 | 17 | operations = [ 18 | migrations.CreateModel( 19 | name='Comment', 20 | fields=[ 21 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 22 | ('text', models.TextField()), 23 | ('created_date', models.DateField(auto_now_add=True)), 24 | ('modelObject', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='proofs.Proof')), 25 | ('user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), 26 | ], 27 | ), 28 | ] 29 | -------------------------------------------------------------------------------- /deductivereasoning/comments/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lyk2018-python/deductive-reasoning/bf3d2c5ce458c27fb3e3e2d9bf52dbfebed52868/deductivereasoning/comments/migrations/__init__.py -------------------------------------------------------------------------------- /deductivereasoning/comments/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | from proofs.models import * 3 | from django.conf import settings 4 | 5 | class Comment(models.Model): 6 | modelObject=models.ForeignKey(Proof,on_delete=models.CASCADE) 7 | user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE, null=True) 8 | text=models.TextField() 9 | created_date=models.DateField(auto_now_add=True) 10 | 11 | def __str__(self): 12 | return self.text 13 | 14 | 15 | # Create your models here. 16 | -------------------------------------------------------------------------------- /deductivereasoning/comments/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /deductivereasoning/deductivereasoning/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lyk2018-python/deductive-reasoning/bf3d2c5ce458c27fb3e3e2d9bf52dbfebed52868/deductivereasoning/deductivereasoning/__init__.py -------------------------------------------------------------------------------- /deductivereasoning/deductivereasoning/settings.py: -------------------------------------------------------------------------------- 1 | """ 2 | Django settings for deductivereasoning project. 3 | 4 | Generated by 'django-admin startproject' using Django 2.0.7. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/2.0/topics/settings/ 8 | 9 | For the full list of settings and their values, see 10 | https://docs.djangoproject.com/en/2.0/ref/settings/ 11 | """ 12 | 13 | import os 14 | 15 | # Build paths inside the project like this: os.path.join(BASE_DIR, ...) 16 | BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 17 | 18 | # Quick-start development settings - unsuitable for production 19 | # See https://docs.djangoproject.com/en/2.0/howto/deployment/checklist/ 20 | 21 | # Application definition 22 | 23 | INSTALLED_APPS = [ 24 | 'django.contrib.admin', 25 | 'django.contrib.auth', 26 | 'django.contrib.contenttypes', 27 | 'django.contrib.sessions', 28 | 'django.contrib.messages', 29 | 'django.contrib.staticfiles', 30 | 'proofs', 31 | 'comments' 32 | ] 33 | 34 | MIDDLEWARE = [ 35 | 'django.middleware.security.SecurityMiddleware', 36 | 'django.contrib.sessions.middleware.SessionMiddleware', 37 | 'django.middleware.common.CommonMiddleware', 38 | 'django.middleware.csrf.CsrfViewMiddleware', 39 | 'django.contrib.auth.middleware.AuthenticationMiddleware', 40 | 'django.contrib.messages.middleware.MessageMiddleware', 41 | 'django.middleware.clickjacking.XFrameOptionsMiddleware', 42 | ] 43 | 44 | ROOT_URLCONF = 'deductivereasoning.urls' 45 | 46 | TEMPLATES = [ 47 | { 48 | 'BACKEND': 'django.template.backends.django.DjangoTemplates', 49 | 'DIRS': [ 50 | os.path.join(BASE_DIR, 'templates'), 51 | ], 52 | 'APP_DIRS': True, 53 | 'OPTIONS': { 54 | 'context_processors': [ 55 | 'django.template.context_processors.debug', 56 | 'django.template.context_processors.request', 57 | 'django.contrib.auth.context_processors.auth', 58 | 'django.contrib.messages.context_processors.messages', 59 | ], 60 | }, 61 | }, 62 | ] 63 | 64 | WSGI_APPLICATION = 'deductivereasoning.wsgi.application' 65 | 66 | 67 | # Database 68 | # https://docs.djangoproject.com/en/2.0/ref/settings/#databases 69 | 70 | DATABASES = { 71 | 'default': { 72 | 'ENGINE': 'django.db.backends.sqlite3', 73 | 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), 74 | } 75 | } 76 | 77 | 78 | # Password validation 79 | # https://docs.djangoproject.com/en/2.0/ref/settings/#auth-password-validators 80 | 81 | AUTH_PASSWORD_VALIDATORS = [ 82 | { 83 | 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', 84 | }, 85 | { 86 | 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', 87 | }, 88 | { 89 | 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', 90 | }, 91 | { 92 | 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', 93 | }, 94 | ] 95 | 96 | 97 | # Internationalization 98 | # https://docs.djangoproject.com/en/2.0/topics/i18n/ 99 | 100 | LANGUAGE_CODE = 'en-us' 101 | 102 | TIME_ZONE = 'UTC' 103 | 104 | USE_I18N = True 105 | 106 | USE_L10N = True 107 | 108 | USE_TZ = True 109 | 110 | 111 | # Static files (CSS, JavaScript, Images) 112 | # https://docs.djangoproject.com/en/2.0/howto/static-files/ 113 | STATIC_DIR = os.path.join(BASE_DIR, 'static') 114 | STATIC_URL = '/static/' 115 | STATICFILES_DIRS= [ 116 | STATIC_DIR, 117 | ] 118 | LOGOUT_REDIRECT_URL = '/' 119 | 120 | try: 121 | from deductivereasoning.local_settings import * 122 | except ImportError: 123 | print( 124 | ''' 125 | Local settings was not found. Duplicate local_settings.example and 126 | rename it to local_settings.py 127 | ''' 128 | ) 129 | except SyntaxError: 130 | print( 131 | ''' 132 | Local settings is misconfigured. 133 | ''' 134 | ) 135 | -------------------------------------------------------------------------------- /deductivereasoning/deductivereasoning/urls.py: -------------------------------------------------------------------------------- 1 | """deductivereasoning URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/2.0/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: path('', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.urls import include, path 14 | 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 15 | """ 16 | from django.contrib import admin 17 | from django.urls import path, include 18 | from proofs import views as proof_views 19 | from accounts import views as account_views 20 | 21 | urlpatterns = [ 22 | path('', proof_views.home, name='home'), 23 | path('admin/', admin.site.urls), 24 | path('submit/', proof_views.submit, name='submit'), 25 | path('proposition//', proof_views.proposition_detail, name='proposition_detail'), 26 | path('accounts/', include('django.contrib.auth.urls')), 27 | path('accounts/signup/', account_views.signup, name='signup'), 28 | path('accounts/profile/', account_views.dashboard, name='dashboard'), 29 | path('about/', proof_views.about, name='about'), 30 | path('accounts/profile//', account_views.profile, name='profile') 31 | ] 32 | -------------------------------------------------------------------------------- /deductivereasoning/deductivereasoning/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for deductivereasoning project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/2.0/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.wsgi import get_wsgi_application 13 | 14 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "deductivereasoning.settings") 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /deductivereasoning/manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import os 3 | import sys 4 | 5 | if __name__ == "__main__": 6 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "deductivereasoning.settings") 7 | try: 8 | from django.core.management import execute_from_command_line 9 | except ImportError as exc: 10 | raise ImportError( 11 | "Couldn't import Django. Are you sure it's installed and " 12 | "available on your PYTHONPATH environment variable? Did you " 13 | "forget to activate a virtual environment?" 14 | ) from exc 15 | execute_from_command_line(sys.argv) 16 | -------------------------------------------------------------------------------- /deductivereasoning/proofs/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lyk2018-python/deductive-reasoning/bf3d2c5ce458c27fb3e3e2d9bf52dbfebed52868/deductivereasoning/proofs/__init__.py -------------------------------------------------------------------------------- /deductivereasoning/proofs/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | from proofs.models import Proposition, Proof 3 | 4 | # Register your models here. 5 | admin.site.register(Proposition) 6 | admin.site.register(Proof) 7 | -------------------------------------------------------------------------------- /deductivereasoning/proofs/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class ProofsConfig(AppConfig): 5 | name = 'proofs' 6 | -------------------------------------------------------------------------------- /deductivereasoning/proofs/forms.py: -------------------------------------------------------------------------------- 1 | from django import forms 2 | 3 | 4 | TRUE_FALSE_CHOICES_UNIVERSAL = ( 5 | (True, 'All'), 6 | (False, 'Some') 7 | ) 8 | TRUE_FALSE_CHOICES_AFFIRMATIVE = ( 9 | (True, 'Are'), 10 | (False, 'Are not') 11 | ) 12 | class MajorSubmissionForm(forms.Form): 13 | is_universal_major = forms.ChoiceField( 14 | choices=TRUE_FALSE_CHOICES_UNIVERSAL, 15 | required=True, 16 | label="Universal", 17 | widget=forms.Select, 18 | ) 19 | subject_major = forms.CharField( 20 | max_length=255, 21 | label='Major subject', 22 | required=False 23 | ) 24 | is_affirmative_major = forms.ChoiceField( 25 | choices=TRUE_FALSE_CHOICES_AFFIRMATIVE, 26 | required=True, 27 | label="Universal", 28 | widget=forms.Select, 29 | ) 30 | predicate_major = forms.CharField( 31 | max_length=255, 32 | label='Major predicate', 33 | required=False 34 | ) 35 | is_universal_minor = forms.ChoiceField( 36 | choices=TRUE_FALSE_CHOICES_UNIVERSAL, 37 | required=True, 38 | label="Universal", 39 | widget=forms.Select, 40 | ) 41 | subject_minor = forms.CharField( 42 | max_length=255, 43 | label='Major subject', 44 | required=False 45 | ) 46 | is_affirmative_minor = forms.ChoiceField( 47 | choices=TRUE_FALSE_CHOICES_AFFIRMATIVE, 48 | required=True, 49 | label="Universal", 50 | widget=forms.Select, 51 | ) 52 | predicate_minor = forms.CharField( 53 | max_length=255, 54 | label='Major predicate', 55 | required=False 56 | ) 57 | is_universal_conclusion = forms.ChoiceField( 58 | choices=TRUE_FALSE_CHOICES_UNIVERSAL, 59 | required=True, 60 | label="Universal", 61 | widget=forms.Select, 62 | ) 63 | subject_conclusion = forms.CharField( 64 | label='Major subject', 65 | required=False, 66 | widget=forms.Select, 67 | ) 68 | is_affirmative_conclusion = forms.ChoiceField( 69 | choices=TRUE_FALSE_CHOICES_AFFIRMATIVE, 70 | required=True, 71 | label="Universal", 72 | widget=forms.Select, 73 | ) 74 | predicate_conclusion = forms.CharField( 75 | label='Major predicate', 76 | required=False, 77 | widget=forms.Select, 78 | ) -------------------------------------------------------------------------------- /deductivereasoning/proofs/migrations/0001_initial.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.0.7 on 2018-08-03 15:29 2 | 3 | from django.conf import settings 4 | from django.db import migrations, models 5 | import django.db.models.deletion 6 | import django.utils.timezone 7 | 8 | 9 | class Migration(migrations.Migration): 10 | 11 | initial = True 12 | 13 | dependencies = [ 14 | migrations.swappable_dependency(settings.AUTH_USER_MODEL), 15 | ] 16 | 17 | operations = [ 18 | migrations.CreateModel( 19 | name='Proof', 20 | fields=[ 21 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 22 | ], 23 | ), 24 | migrations.CreateModel( 25 | name='Proposition', 26 | fields=[ 27 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 28 | ('is_universal', models.BooleanField()), 29 | ('subject', models.CharField(max_length=30)), 30 | ('is_affirmative', models.BooleanField()), 31 | ('predicate', models.CharField(max_length=30)), 32 | ('created_date', models.DateTimeField(default=django.utils.timezone.now)), 33 | ('user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), 34 | ], 35 | ), 36 | migrations.AddField( 37 | model_name='proof', 38 | name='conclusion', 39 | field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='conclusion', to='proofs.Proposition'), 40 | ), 41 | migrations.AddField( 42 | model_name='proof', 43 | name='major', 44 | field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='major', to='proofs.Proposition'), 45 | ), 46 | migrations.AddField( 47 | model_name='proof', 48 | name='minor', 49 | field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='minor', to='proofs.Proposition'), 50 | ), 51 | migrations.AddField( 52 | model_name='proof', 53 | name='user', 54 | field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL), 55 | ), 56 | ] 57 | -------------------------------------------------------------------------------- /deductivereasoning/proofs/migrations/0002_proof_form_type.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.1 on 2018-08-17 19:46 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('proofs', '0001_initial'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='proof', 15 | name='form_type', 16 | field=models.CharField(default='none', max_length=15), 17 | preserve_default=False, 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /deductivereasoning/proofs/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lyk2018-python/deductive-reasoning/bf3d2c5ce458c27fb3e3e2d9bf52dbfebed52868/deductivereasoning/proofs/migrations/__init__.py -------------------------------------------------------------------------------- /deductivereasoning/proofs/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | from django.conf import settings 3 | from django.utils import timezone 4 | 5 | 6 | def universal(universal): 7 | if universal == True: 8 | return "All" 9 | else: 10 | return "Some" 11 | 12 | def affirmative(affirmative): 13 | if affirmative == True: 14 | return "Are" 15 | else: 16 | return "Are not" 17 | 18 | class Proposition(models.Model): 19 | """ 20 | 21 | """ 22 | user = models.ForeignKey( 23 | settings.AUTH_USER_MODEL, 24 | null=True, 25 | on_delete=models.CASCADE, 26 | ) 27 | is_universal = models.BooleanField() 28 | subject = models.CharField(max_length=30) 29 | is_affirmative = models.BooleanField() 30 | predicate = models.CharField(max_length=30) 31 | created_date = models.DateTimeField(default=timezone.now) 32 | 33 | def __str__(self): 34 | return universal(self.is_universal) + " " + self.subject + " " + affirmative(self.is_affirmative) + " " + self.predicate 35 | 36 | class Proof(models.Model): 37 | """ 38 | 39 | """ 40 | user = models.ForeignKey( 41 | settings.AUTH_USER_MODEL, 42 | null=True, 43 | on_delete=models.CASCADE, 44 | ) 45 | major = models.ForeignKey( 46 | Proposition, 47 | related_name='major', 48 | on_delete=models.CASCADE, 49 | ) 50 | minor = models.ForeignKey( 51 | Proposition, 52 | related_name='minor', 53 | on_delete=models.CASCADE, 54 | ) 55 | conclusion = models.ForeignKey( 56 | Proposition, 57 | related_name='conclusion', 58 | on_delete=models.CASCADE, 59 | ) 60 | form_type = models.CharField(max_length=15) 61 | 62 | def __str__(self): 63 | return (universal(self.major.is_universal)+ " " + self.major.subject + " " + affirmative(self.major.is_affirmative) + " " + self.major.predicate + "___" 64 | + universal(self.minor.is_universal)+ " " + self.minor.subject + " " + affirmative(self.minor.is_affirmative) + " " + self.minor.predicate + "___" 65 | + universal(self.conclusion.is_universal)+ " " + self.conclusion.subject + " " + affirmative(self.conclusion.is_affirmative) + " " + self.conclusion.predicate) 66 | -------------------------------------------------------------------------------- /deductivereasoning/proofs/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /deductivereasoning/proofs/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render, redirect 2 | from proofs.models import * 3 | from .forms import MajorSubmissionForm 4 | from django.urls import reverse 5 | from comments.forms import CommentForm 6 | from comments.models import Comment 7 | from django.core.paginator import EmptyPage, PageNotAnInteger, Paginator 8 | 9 | 10 | def home(request): 11 | concobj = [] 12 | conclusions = Proof.objects.all() 13 | for obj in conclusions: 14 | concobj.insert(0, obj.conclusion) 15 | paginator = Paginator(concobj,10) 16 | page = request.GET.get('page') 17 | concPaginationObjs = paginator.get_page(page) 18 | return render(request, 'home.html', { 19 | 'title': 'Tümden Gelim', 20 | 'conclusions': concPaginationObjs, 21 | }) 22 | 23 | def about(request): 24 | return render(request, 'about.html') 25 | 26 | def proposition_detail(request, id): 27 | proofs = Proposition.objects.get(id=id).conclusion.all()[0] 28 | conclusion = proofs.conclusion 29 | major = proofs.major 30 | minor = proofs.minor 31 | form = CommentForm() 32 | if request.method == "POST": 33 | form = CommentForm(request.POST) 34 | if form.is_valid(): 35 | comment = form.save(commit=False) 36 | comment.user = request.user 37 | comment.modelObject = proofs 38 | comment.save() 39 | Comments = Comment.objects.filter(modelObject=proofs) 40 | return render(request, 'proposition_detail.html', { 41 | 'proof': proofs, 42 | 'major': major, 43 | 'minor': minor, 44 | 'conclusion': conclusion, 45 | 'title': 'Önerme', 46 | 'form': form, 47 | 'Comments': Comments, 48 | }) 49 | 50 | 51 | def submit(request): 52 | form = MajorSubmissionForm() 53 | 54 | if request.method == "POST": 55 | form = MajorSubmissionForm(request.POST) 56 | if form.is_valid(): 57 | major_type = get_proposition_type(form.cleaned_data['is_universal_major'], form.cleaned_data['is_affirmative_major']) 58 | minor_type = get_proposition_type(form.cleaned_data['is_universal_minor'], form.cleaned_data['is_affirmative_minor']) 59 | conclusion_type = get_proposition_type(form.cleaned_data['is_universal_conclusion'], form.cleaned_data['is_affirmative_conclusion']) 60 | type_as_string = conclusion_name(major_type, minor_type, conclusion_type) 61 | error = "" 62 | if type_as_string == 'NONE': 63 | error = error + "Invalid arg form: \"None\", " 64 | if (not form.cleaned_data['subject_major'] or not form.cleaned_data['predicate_major'] or not 65 | form.cleaned_data['subject_minor'] or not form.cleaned_data['predicate_minor'] or not 66 | form.cleaned_data['subject_conclusion'] or not form.cleaned_data['predicate_conclusion']): 67 | error = error + "Please fill in the required fields." 68 | if error: 69 | return render(request ,"submit.html", { 70 | 'form': form, 71 | 'error': error 72 | }) 73 | major = Proposition.objects.create( 74 | is_universal=form.cleaned_data['is_universal_major'], 75 | subject=form.cleaned_data['subject_major'], 76 | is_affirmative=form.cleaned_data['is_affirmative_major'], 77 | predicate=form.cleaned_data['predicate_major'], 78 | user=request.user, 79 | ) 80 | minor = Proposition.objects.create( 81 | is_universal=form.cleaned_data['is_universal_minor'], 82 | subject=form.cleaned_data['subject_minor'], 83 | is_affirmative=form.cleaned_data['is_affirmative_minor'], 84 | predicate=form.cleaned_data['predicate_minor'], 85 | user=request.user, 86 | ) 87 | conclusion = Proposition.objects.create( 88 | is_universal=form.cleaned_data['is_universal_conclusion'], 89 | subject=form.cleaned_data['subject_conclusion'], 90 | is_affirmative=form.cleaned_data['is_affirmative_conclusion'], 91 | predicate=form.cleaned_data['predicate_conclusion'], 92 | user=request.user, 93 | ) 94 | major.save() 95 | minor.save() 96 | conclusion.save() 97 | Proof.objects.create( 98 | major=major, 99 | minor=minor, 100 | conclusion=conclusion, 101 | form_type=type_as_string 102 | ) 103 | return redirect(reverse("proposition_detail", args=[conclusion.id])) 104 | 105 | return render(request ,"submit.html", {'form': form}) 106 | 107 | def get_proposition_type(universal, affirmative): 108 | if universal == 'True' and affirmative == 'True': 109 | return "A" 110 | elif universal == 'True' and affirmative == 'False': 111 | return "I" 112 | elif universal == 'False' and affirmative == 'True': 113 | return "E" 114 | else: 115 | return "O" 116 | 117 | def conclusion_name(major, minor, conclusion): 118 | if major == "A" and minor == "A" and conclusion == "A" : 119 | return "Barbara" 120 | elif major == "E" and minor == "A" and conclusion == "E": 121 | return "Cesare" 122 | elif major == "A" and minor == "I" and conclusion == "I": 123 | return "Datisi" 124 | elif major == "E" and minor == "I" and conclusion == "O": 125 | return "Ferison" 126 | elif major == "A" and minor == "E" and conclusion == "O": 127 | return "Camestros" 128 | elif major == "A" and minor == "O" and conclusion == "O": 129 | return "Baroco" 130 | elif major == "O" and minor == "A" and conclusion == "O": 131 | return "Bocardo" 132 | elif major == "E" and minor == "A" and conclusion == "O": 133 | return "Celaront" 134 | elif major == "A" and minor == "E" and conclusion == "E": 135 | return "Calemes" 136 | elif major == "I" and minor == "A" and conclusion == "I": 137 | return "Disamis" 138 | else: 139 | return "NONE" -------------------------------------------------------------------------------- /deductivereasoning/static/facebook.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lyk2018-python/deductive-reasoning/bf3d2c5ce458c27fb3e3e2d9bf52dbfebed52868/deductivereasoning/static/facebook.png -------------------------------------------------------------------------------- /deductivereasoning/static/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lyk2018-python/deductive-reasoning/bf3d2c5ce458c27fb3e3e2d9bf52dbfebed52868/deductivereasoning/static/favicon.ico -------------------------------------------------------------------------------- /deductivereasoning/static/github.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lyk2018-python/deductive-reasoning/bf3d2c5ce458c27fb3e3e2d9bf52dbfebed52868/deductivereasoning/static/github.png -------------------------------------------------------------------------------- /deductivereasoning/static/js/submit.js: -------------------------------------------------------------------------------- 1 | window.onload = showErrorDiv; 2 | function showErrorDiv(){ 3 | var error = document.getElementById('errorForPythonCheck').innerHTML; 4 | if(error==''){ 5 | document.getElementById('errorForPythonCheck').style.display = 'none'; 6 | } 7 | else{ 8 | document.getElementById('errorForPythonCheck').style.display = ''; 9 | } 10 | } 11 | function onInputTextValueChange(){ 12 | //Boolean Python 13 | var is_universal_major = document.getElementById('id_is_universal_major').value; 14 | var is_affirmative_major = document.getElementById('id_is_affirmative_major').value; 15 | var is_universal_minor = document.getElementById('id_is_universal_minor').value; 16 | var is_affirmative_minor = document.getElementById('id_is_affirmative_minor').value; 17 | var is_universal_conclusion = document.getElementById('id_is_universal_conclusion').value; 18 | var is_affirmative_conclusion = document.getElementById('id_is_affirmative_conclusion').value; 19 | 20 | //Boolean Js 21 | var is_universal_majorJS = convertToJSBoolean(is_universal_major); 22 | var is_affirmative_majorJS = convertToJSBoolean(is_affirmative_major); 23 | var is_universal_minorJS = convertToJSBoolean(is_universal_minor); 24 | var is_affirmative_minorJS = convertToJSBoolean(is_affirmative_minor); 25 | var is_universal_conclusionJS = convertToJSBoolean(is_universal_conclusion); 26 | var is_affirmative_conclusionJS = convertToJSBoolean(is_affirmative_conclusion); 27 | 28 | //Conclusions 29 | var majorConclusionType = getConclusionType(is_universal_majorJS, is_affirmative_majorJS); 30 | var minorConclusionType = getConclusionType(is_universal_minorJS, is_affirmative_minorJS); 31 | var conclusionConclusionType = getConclusionType(is_universal_conclusionJS, is_affirmative_conclusionJS); 32 | var isValid = isConclusionValid(majorConclusionType, minorConclusionType, conclusionConclusionType); 33 | 34 | //Textfields 35 | var major_subject = document.getElementById('id_subject_major').value; 36 | var major_predicate = document.getElementById('id_predicate_major').value; 37 | var minor_subject = document.getElementById('id_subject_minor').value; 38 | var minor_predicate = document.getElementById('id_predicate_minor').value; 39 | 40 | //Decide whether button should be disabled or not according to the inputs 41 | if (major_subject == "" || major_predicate == "" || minor_subject == "" || minor_predicate == "") { 42 | document.getElementById("buttonSubmit").disabled = true; 43 | if (!isValid) { 44 | document.getElementById("invalidArg").style.display = ''; 45 | document.getElementById("buttonSubmit").disabled = true; 46 | } 47 | else{ 48 | document.getElementById("invalidArg").style.display = 'none'; 49 | } 50 | } 51 | else{ 52 | document.getElementById("buttonSubmit").disabled = false; 53 | if (isValid) { 54 | document.getElementById("invalidArg").style.display = 'none'; 55 | } 56 | else{ 57 | document.getElementById("invalidArg").style.display = ''; 58 | document.getElementById("buttonSubmit").disabled = true; 59 | } 60 | } 61 | } 62 | 63 | //Convert method 64 | function convertToJSBoolean(boolToConvert){ 65 | if (boolToConvert == 'True'){ 66 | return true; 67 | } 68 | else{ 69 | return false; 70 | } 71 | } 72 | 73 | //Decision table 74 | function isConclusionValid(major, minor, conclusion){ 75 | var isValid; 76 | if (major == "A" && minor == "A" && conclusion == "A") { 77 | document.getElementById("conclusionName").innerHTML = "Conclusion Form: \"Barbara\""; 78 | isValid = true; 79 | } 80 | else if (major == "E" && minor == "A" && conclusion == "E"){ 81 | document.getElementById("conclusionName").innerHTML = "Conclusion Form: \"Cesare\""; 82 | isValid = true; 83 | } 84 | else if (major == "A" && minor == "I" && conclusion == "I"){ 85 | document.getElementById("conclusionName").innerHTML = "Conclusion Form: \"Datisi\""; 86 | isValid = true; 87 | } 88 | else if (major == "E" && minor == "I" && conclusion == "O"){ 89 | document.getElementById("conclusionName").innerHTML = "Conclusion Form: \"Ferison\""; 90 | isValid = true; 91 | } 92 | else if (major == "A" && minor == "E" && conclusion == "O"){ 93 | document.getElementById("conclusionName").innerHTML = "Conclusion Form: \"Camestros\""; 94 | isValid = true; 95 | } 96 | else if (major == "A" && minor == "O" && conclusion == "O"){ 97 | document.getElementById("conclusionName").innerHTML = "Conclusion Form: \"Baroco\""; 98 | isValid = true; 99 | } 100 | else if (major == "O" && minor == "A" && conclusion == "O"){ 101 | document.getElementById("conclusionName").innerHTML = "Conclusion Form: \"Bocardo\""; 102 | isValid = true; 103 | } 104 | else if (major == "E" && minor == "A" && conclusion == "O"){ 105 | document.getElementById("conclusionName").innerHTML = "Conclusion Form: \"Celaront\""; 106 | isValid = true; 107 | } 108 | else if (major == "A" && minor == "E" && conclusion == "E"){ 109 | document.getElementById("conclusionName").innerHTML = "Conclusion Form: \"Calemes\""; 110 | isValid = true; 111 | } 112 | else if (major == "I" && minor == "A" && conclusion == "I"){ 113 | document.getElementById("conclusionName").innerHTML = "Conclusion Form: \"Disamis\""; 114 | isValid = true; 115 | } 116 | else{ 117 | document.getElementById("conclusionName").innerHTML = "Conclusion Form: None"; 118 | isValid = false; 119 | } 120 | if (document.getElementById("conclusionName").innerHTML.includes("None")) { 121 | document.getElementById("conclusionName").style.color="rgb(255, 106, 96)"; 122 | } 123 | else{ 124 | document.getElementById("conclusionName").style.color="green"; 125 | } 126 | return isValid; 127 | } 128 | function getConclusionType(universal, affirmative){ 129 | if(universal == true && affirmative == true){ 130 | return "A"; 131 | } 132 | else if (universal == true && affirmative == false){ 133 | return "I"; 134 | } 135 | else if (universal == false && affirmative == true){ 136 | return "E"; 137 | } 138 | else{ 139 | return "O"; 140 | } 141 | } 142 | 143 | //Put elements in SelectOneMenus 144 | function getElements(){ 145 | var subject_conclusion_select_items = document.getElementById('id_subject_conclusion'); 146 | var predicate_conclusion_select_items = document.getElementById('id_predicate_conclusion'); 147 | subject_conclusion_select_items.innerHTML = ''; 148 | predicate_conclusion_select_items.innerHTML = ''; 149 | var major_subject = document.getElementById('id_subject_major').value; 150 | var major_predicate = document.getElementById('id_predicate_major').value; 151 | var minor_subject = document.getElementById('id_subject_minor').value; 152 | var minor_predicate = document.getElementById('id_predicate_minor').value; 153 | var subject_conclusion_select_items = document.getElementById('id_subject_conclusion'); 154 | if(major_subject != null && major_subject != '' && subject_conclusion_select_items.innerHTML.indexOf('>'+major_subject+'<') == -1){ 155 | subject_conclusion_select_items.innerHTML += ''; 156 | predicate_conclusion_select_items.innerHTML += ''; 157 | } 158 | if(major_predicate != null && major_predicate != '' && subject_conclusion_select_items.innerHTML.indexOf('>'+major_predicate+'<') == -1){ 159 | subject_conclusion_select_items.innerHTML += ''; 160 | predicate_conclusion_select_items.innerHTML += ''; 161 | } 162 | if(minor_subject != null && minor_subject != '' && subject_conclusion_select_items.innerHTML.indexOf('>'+minor_subject+'<') == -1){ 163 | subject_conclusion_select_items.innerHTML += ''; 164 | predicate_conclusion_select_items.innerHTML += ''; 165 | } 166 | if(minor_predicate != null && minor_predicate != '' && subject_conclusion_select_items.innerHTML.indexOf('>'+minor_predicate+'<') == -1){ 167 | subject_conclusion_select_items.innerHTML += ''; 168 | predicate_conclusion_select_items.innerHTML += ''; 169 | } 170 | onInputTextValueChange(); 171 | } -------------------------------------------------------------------------------- /deductivereasoning/static/layout/styles/base.css: -------------------------------------------------------------------------------- 1 | * { 2 | -webkit-box-sizing: border-box; 3 | -moz-box-sizing: border-box; 4 | -o-box-sizing: border-box; 5 | box-sizing: border-box; 6 | } 7 | 8 | body { 9 | background-color: #D6EFE2; 10 | font-family: Helvetica, sans-serif; 11 | font-size: 16px; 12 | } 13 | 14 | a { 15 | text-decoration: none; 16 | } 17 | 18 | .clear { 19 | clear: both; 20 | } 21 | 22 | .container { 23 | width: 940px; 24 | margin-right: auto; 25 | margin-left: auto; 26 | //border: 1px solid gray; 27 | padding-top: 20px; 28 | padding-left: 30px; 29 | padding-right: 30px; 30 | padding-bottom: 50px; 31 | } 32 | 33 | #overlay { 34 | position: fixed; 35 | display: none; 36 | width: 100%; 37 | height: 100%; 38 | top: 0; 39 | left: 0; 40 | right: 0; 41 | bottom: 0; 42 | background-color: rgba(0,0,0,0.5); 43 | z-index: 2; 44 | cursor: pointer; 45 | } 46 | 47 | .header img { 48 | float: left; 49 | } 50 | 51 | .header ul { 52 | display: inline-block; 53 | float: right; 54 | margin-top: 36px; 55 | } 56 | 57 | .header ul li { 58 | display: inline-block; 59 | margin-left: 10px; 60 | } 61 | 62 | .header ul li a { 63 | font-size: 24px; 64 | font-weight: 600; 65 | border-bottom: 6px solid #F3FD83; 66 | color: #333646; 67 | text-decoration: none; 68 | } 69 | 70 | .header ul li a:hover { 71 | border-bottom: 6px solid yellow; 72 | } 73 | 74 | .header .hamburger { 75 | display: none; 76 | margin-top: 30px; 77 | margin-right: 30px; 78 | float: right; 79 | } 80 | 81 | .header .hamburger div { 82 | width: 35px; 83 | height: 6px; 84 | border-radius: 2px; 85 | background-color: #333646; 86 | margin: 6px 0; 87 | z-index: 99; 88 | } 89 | 90 | .sidebar { 91 | display: none; 92 | height: 100%; 93 | width: 140px; 94 | position: absolute; 95 | z-index: 10; 96 | top: 0; 97 | right: 0; 98 | background-color: #F3FD83; 99 | overflow-x: hidden; 100 | padding-top: 16px; 101 | } 102 | 103 | .sidebar a { 104 | padding: 14px 10px 14px 10px; 105 | text-align: center; 106 | text-decoration: none; 107 | font-size: 22px; 108 | font-weight: 600; 109 | color: #333646; 110 | display: block; 111 | } 112 | 113 | .sidebar a:hover { 114 | background-color: yellow; 115 | } 116 | 117 | #sidelang { 118 | margin-top: 20px; 119 | display: inline-block; 120 | } 121 | 122 | .nav { 123 | display: inline-block; 124 | margin-top: 50px; 125 | } 126 | 127 | .nav ul li{ 128 | float: left; 129 | display: inline-block; 130 | margin-left: 0; 131 | } 132 | 133 | .nav ul li:first-child { 134 | margin-left: 0; 135 | } 136 | 137 | .nav ul li a { 138 | background-color: #F3FD83; 139 | padding: 10px 20px 10px 20px; 140 | font-size: 20px; 141 | font-weight: 600; 142 | color: #333646; 143 | text-decoration: none; 144 | } 145 | 146 | .nav ul li a:hover { 147 | background-color: yellow; 148 | } 149 | 150 | .content { 151 | margin-top: 50px; 152 | //background-color: red; 153 | } 154 | 155 | .content .left { 156 | width: 600px; 157 | display: inline-block; 158 | float: left; 159 | //background-color: purple; 160 | } 161 | 162 | .content .left .box { 163 | margin-left: 24px; 164 | width: 552px; 165 | margin-bottom: 30px; 166 | background-color: rgba(51,54,70,0.16); 167 | border-bottom: 1px solid #333646; 168 | padding: 30px; 169 | text-align: center; 170 | font-size: 18px; 171 | letter-spacing: 3px;l 172 | } 173 | 174 | .content .left .box:hover{ 175 | background-color: rgba(51,54,70,0.3); 176 | } 177 | 178 | .content .left button { 179 | width: 120px; 180 | height: 24px; 181 | border: 0; 182 | margin-left: 236px; 183 | background-image: url('load.png'); 184 | background-repeat: no-repeat; 185 | } 186 | 187 | .content .right { 188 | width: 278px; 189 | display: inline-block; 190 | float: left; 191 | background-color: orange; 192 | } 193 | .content .propDetail{ 194 | background-color: #9EF0C5; 195 | padding: 10px 20px 20px 20px; 196 | font-size: 20px; 197 | font-weight: 600; 198 | margin-bottom: 20px; 199 | margin-right: 40%; 200 | line-height: 2; 201 | } 202 | .content .createdBy{ 203 | font: italic bold 12px/30px Georgia, serif; 204 | text-align:right; 205 | margin-bottom: -15px; 206 | } 207 | .content .createdBy p{ 208 | line-height: 1.5; 209 | } 210 | 211 | .box{ 212 | background-color: #9EF0C5; 213 | padding: 20px 20px 20px 20px; 214 | font-size: 20px; 215 | font-weight: 600; 216 | margin-bottom: 20px; 217 | margin-right: 40%; 218 | } 219 | 220 | .box a{ 221 | color: green; 222 | text-decoration: none; 223 | } 224 | 225 | .footer{ 226 | background-color: #F3FD83; 227 | margin-top: 20px; 228 | padding: 10px 20px 10px 20px; 229 | font-size: 20px; 230 | color: #333646; 231 | display: inline-block; 232 | text-decoration: none; 233 | } 234 | 235 | .comment h3{ 236 | font-size: 25px; 237 | font-weight: 600; 238 | margin-bottom: 15px; 239 | color: green; 240 | } 241 | 242 | .commentBox{ 243 | background-color: #CCF59A; 244 | font-weight: normal; 245 | word-wrap: break-word; 246 | } 247 | 248 | .box .commentUser{ 249 | text-align: right; 250 | font-weight: 600; 251 | } 252 | 253 | .about{ 254 | background-color: #9EF0C5; 255 | padding: 20px 20px 20px 20px; 256 | font-size: 20px; 257 | line-height: 1.6; 258 | margin-bottom: 20px; 259 | margin-right: 40%; 260 | } 261 | 262 | .dashboard{ 263 | font-weight: normal; 264 | font-size: 20px; 265 | line-height: 1.4; 266 | } 267 | 268 | .selectBox { 269 | padding: 4px; 270 | margin: 5px; 271 | color: #333646; 272 | font-size: 15px; 273 | border: none; 274 | background-color: #F3FD83; 275 | } 276 | 277 | .selectBox:hover { 278 | cursor: pointer; 279 | } 280 | 281 | .submitText { 282 | width: 30%; 283 | height: 25px; 284 | border: none; 285 | font-size: 16px; 286 | padding-left: 5px; 287 | color: #333646; 288 | } 289 | 290 | .helptext { 291 | font-size: 12px; 292 | color: red; 293 | } 294 | 295 | .argument { 296 | margin: 8px; 297 | } 298 | 299 | .argument p { 300 | color: #333646; 301 | padding: 5px; 302 | } 303 | 304 | .changeBox { 305 | padding: 4px; 306 | margin: 5px; 307 | border: none; 308 | background-color: white; 309 | width: 120px; 310 | font-size: 16px; 311 | padding-left: 5px; 312 | } 313 | 314 | .btnSubmit { 315 | margin: 13px; 316 | border: none; 317 | width: 70px; 318 | height: 40px; 319 | background-color: #F3FD83; 320 | color: #333646; 321 | font-size: 14px; 322 | font-weight: bold; 323 | } 324 | 325 | .btnSubmit:hover { 326 | cursor: pointer; 327 | background-color: yellow; 328 | } 329 | 330 | .btnSubmit:disabled{ 331 | background-color: #cac698; 332 | } 333 | 334 | .submitWarning { 335 | color: #333646; 336 | margin: 15px 0px 5px 15px; 337 | } 338 | 339 | .loginWarning { 340 | color: red !important; 341 | font-size: 14px; 342 | font-weight: bold; 343 | } 344 | 345 | .invalidArgError { 346 | background-color: #ff002d; 347 | color: #F2F2F2; 348 | text-align: center; 349 | padding: 17px 35px; 350 | font-size: 16px; 351 | border: none; 352 | letter-spacing: 0.5px; 353 | margin-bottom: 5px; 354 | } 355 | 356 | .social-media { 357 | color: #333646; 358 | } 359 | 360 | .footer a { 361 | color: green; 362 | font-weight: 600; 363 | } 364 | 365 | .welcome { 366 | font-size: 30px; 367 | } 368 | 369 | .alert { 370 | background-color: #ff002d; 371 | color: #F2F2F2; 372 | text-align: center; 373 | padding: 17px 35px; 374 | font-size: 16px; 375 | border: none; 376 | letter-spacing: 0.5px; 377 | margin-bottom: 5px; 378 | } 379 | 380 | .propDetail p{ 381 | font-family: Helvetica; 382 | color: rgb(255, 106, 96); 383 | } 384 | 385 | .createdBy p { 386 | color: black; 387 | } 388 | 389 | 390 | @media (max-width: 940px) { 391 | .container { 392 | width: 94%; 393 | margin-right: auto; 394 | margin-left: auto; 395 | padding-left: 3%; 396 | padding-right: 3%; 397 | } 398 | } 399 | 400 | @media (max-width: 768px) { 401 | .container { 402 | width: 94%; 403 | margin-right: auto; 404 | margin-left: auto; 405 | padding-top: 20px; 406 | padding-left: 3%; 407 | padding-right: 3%; 408 | padding-bottom: 50px; 409 | } 410 | .content .propDetail{ 411 | margin-right: 0; 412 | } 413 | .box { 414 | margin-right: 0; 415 | } 416 | .about{ 417 | margin-right: 0; 418 | } 419 | } 420 | 421 | @media (max-width: 584px) { 422 | .container { 423 | width: 94%; 424 | margin-right: auto; 425 | margin-left: auto; 426 | padding-left: 3%; 427 | padding-right: 3%; 428 | } 429 | 430 | .header ul { 431 | display: none; 432 | } 433 | 434 | .header .hamburger { 435 | display: inline-block; 436 | } 437 | 438 | .nav { 439 | display: none; 440 | } 441 | } 442 | 443 | @media (max-width: 480px) { 444 | .header .hamburger { 445 | margin-right: 10; 446 | } 447 | 448 | .content .propDetail{ 449 | padding: 10px 20px 20px 20px; 450 | font-size: 18px; 451 | margin-bottom: 20px; 452 | } 453 | 454 | .box { 455 | padding: 16px; 456 | font-size: 18px; 457 | margin-bottom: 10px; 458 | } 459 | 460 | .about{ 461 | font-size: 18px; 462 | } 463 | 464 | .comment h3{ 465 | font-size: 22px; 466 | margin-bottom: 10px; 467 | } 468 | 469 | .footer{ 470 | margin-top: 14px; 471 | font-size: 18px; 472 | } 473 | .pagination{ 474 | width: 330px; 475 | } 476 | .pagination .step-links a { 477 | padding: 8px 10px !important; 478 | font-size: 13px; 479 | } 480 | .current{ 481 | font-weight: bold; 482 | font-size: 13px; 483 | } 484 | } 485 | 486 | @media (max-width: 378px) { 487 | .header img { 488 | width: 70%; 489 | } 490 | 491 | .header .hamburger { 492 | margin-top: 20; 493 | } 494 | 495 | .content .propDetail{ 496 | padding: 10px 20px 20px 20px; 497 | font-size: 16px; 498 | margin-bottom: 20px; 499 | } 500 | 501 | .box { 502 | padding: 14px; 503 | font-size: 16px; 504 | margin-bottom: 8px; 505 | } 506 | 507 | .about{ 508 | font-size: 18px; 509 | } 510 | 511 | .comment h3{ 512 | font-size: 22px; 513 | margin-bottom: 8px; 514 | } 515 | 516 | .footer{ 517 | margin-top: 12px; 518 | font-size: 16px; 519 | } 520 | } 521 | 522 | .pagination { 523 | display: inline-block; 524 | } 525 | .pagination .step-links a { 526 | font-weight: bold; 527 | padding: 8px 16px; 528 | background-color: #7ff5b7; 529 | color: black; 530 | } 531 | .current{ 532 | font-weight: bold; 533 | } -------------------------------------------------------------------------------- /deductivereasoning/static/layout/styles/reset.css: -------------------------------------------------------------------------------- 1 | /* http://meyerweb.com/eric/tools/css/reset/ 2 | v2.0 | 20110126 3 | License: none (public domain) 4 | */ 5 | 6 | html, body, div, span, applet, object, iframe, 7 | h1, h2, h3, h4, h5, h6, p, blockquote, pre, 8 | a, abbr, acronym, address, big, cite, code, 9 | del, dfn, em, img, ins, kbd, q, s, samp, 10 | small, strike, strong, sub, sup, tt, var, 11 | b, u, i, center, 12 | dl, dt, dd, ol, ul, li, 13 | fieldset, form, label, legend, 14 | table, caption, tbody, tfoot, thead, tr, th, td, 15 | article, aside, canvas, details, embed, 16 | figure, figcaption, footer, header, hgroup, 17 | menu, nav, output, ruby, section, summary, 18 | time, mark, audio, video { 19 | margin: 0; 20 | padding: 0; 21 | border: 0; 22 | font-size: 100%; 23 | font: inherit; 24 | vertical-align: baseline; 25 | } 26 | /* HTML5 display-role reset for older browsers */ 27 | article, aside, details, figcaption, figure, 28 | footer, header, hgroup, menu, nav, section { 29 | display: block; 30 | } 31 | body { 32 | line-height: 1; 33 | } 34 | ol, ul { 35 | list-style: none; 36 | } 37 | blockquote, q { 38 | quotes: none; 39 | } 40 | blockquote:before, blockquote:after, 41 | q:before, q:after { 42 | content: ''; 43 | content: none; 44 | } 45 | table { 46 | border-collapse: collapse; 47 | border-spacing: 0; 48 | } 49 | -------------------------------------------------------------------------------- /deductivereasoning/static/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lyk2018-python/deductive-reasoning/bf3d2c5ce458c27fb3e3e2d9bf52dbfebed52868/deductivereasoning/static/logo.png -------------------------------------------------------------------------------- /deductivereasoning/static/twitter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lyk2018-python/deductive-reasoning/bf3d2c5ce458c27fb3e3e2d9bf52dbfebed52868/deductivereasoning/static/twitter.png -------------------------------------------------------------------------------- /deductivereasoning/templates/about.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block title %}{{ 'About Page' }}{% endblock %} 4 | 5 | {% block content %} 6 |
7 |

This site made in "Mustafa Akgül Özgür Yazılım Yaz Kampı" as a django course project and gives you a deductive reasoning tool.

8 |

You can check the validity of primeses and conclusion via our tool.

9 | Have Fun! 10 |
11 | {% endblock %} 12 | -------------------------------------------------------------------------------- /deductivereasoning/templates/accounts/dashboard.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | 3 | {% block title %}{{ title }}{% endblock %} 4 | 5 | {% block content %} 6 |
7 |

Welcome {{ user.username }}

8 | {% if user.first_name and user.last_name %} 9 | Name: {{ user.first_name }} 10 |
11 | Surname: {{ user.last_name }} 12 |
13 | {% endif %} 14 | Username: {{ user.username }} 15 |
16 | {% if user.email %} 17 | User Email: {{ user.email }} 18 |
19 | {% endif %} 20 | Last Login: {{ user.last_login }} 21 |
22 | Date Joined: {{ user.date_joined }} 23 |
24 | {% endblock %} 25 | -------------------------------------------------------------------------------- /deductivereasoning/templates/accounts/profile.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block title %}{{ title }}{% endblock %} 4 | 5 | {% block content %} 6 |
7 |

{{ user.username }}

8 | {% if user.first_name and user.last_name %} 9 | Name: {{ user.first_name }} 10 |
11 | Surname: {{ user.last_name }} 12 |
13 | {% endif %} 14 | Username: {{ user.username }} 15 |
16 | {% if user.email %} 17 | User Email: {{ user.email }} 18 |
19 | {% endif %} 20 | {% if numOfConcs %} 21 | Number of conclusions created by user: {{ numOfConcs }} 22 |
23 | {% endif %} 24 | Last Login: {{ user.last_login }} 25 |
26 | Date Joined: {{ user.date_joined }} 27 |
28 | {% endblock %} -------------------------------------------------------------------------------- /deductivereasoning/templates/base.html: -------------------------------------------------------------------------------- 1 | {% load static %} 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | {% block title %} Default Title {% endblock %} 11 | 12 | 13 | 14 |
15 |
16 |
17 | 18 | 19 | 20 |
21 |
22 |
23 |
24 |
25 | 37 |
38 |
39 | 80 | 110 | 111 |
112 | {% block content %} 113 | {% endblock %} 114 |
115 | 116 | 119 | 144 | {% block scripts %} 145 | {% endblock %} 146 | 147 | 148 | -------------------------------------------------------------------------------- /deductivereasoning/templates/home.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block title %}{{ title }}{% endblock %} 4 | 5 | {% block content %} 6 | 23 | {% for conclusion in conclusions %} 24 | 37 |
38 | {% endfor %} 39 | 56 | {% endblock %} 57 | -------------------------------------------------------------------------------- /deductivereasoning/templates/proposition_detail.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block title %}{{ title }}{% endblock %} 4 | {% block content %} 5 |
6 |
7 |
Type: "{{ proof.form_type }}"
8 |

{{ major }}

9 |

{{ minor }}

10 |

{{ conclusion }}

11 | 12 | 13 |

Created by:{{ major.user }}

14 |

Date:{{ major.created_date }}

15 |
16 |
17 |
18 |
19 |
20 |
21 | {% csrf_token %} 22 | {% if Comments %} 23 |

Comments

24 | {% for Comment in Comments %} 25 |
26 |

From {{ Comment.user }} on {{ Comment.created_date }}

27 |

" {{ Comment }} "

28 |
29 | {% endfor %} 30 | {% endif %} 31 |

Send Comment

32 |
33 | {% if user.is_authenticated %} 34 | 35 |
36 | 37 | {% else %} 38 |

You need to login in order to comment

39 | {% endif %} 40 | 41 |
42 | {% endblock %} 43 | -------------------------------------------------------------------------------- /deductivereasoning/templates/registration/login.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | {% block title %}Login{% endblock %} 3 | 4 | {% block content %} 5 |
6 |
7 | {% csrf_token %} 8 |
9 |

10 | 11 | 12 |

13 |

14 | 15 | 16 |

17 | 18 | {% if form.errors %} 19 | {% for error in form.non_field_errors %} 20 |
21 | {{ error|escape }} 22 |
23 | {% endfor %} 24 | {% endif %} 25 |
26 |
27 |
28 | {% endblock %} 29 | -------------------------------------------------------------------------------- /deductivereasoning/templates/registration/signup.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | {% block title %}Sign Up{% endblock %} 3 | 4 | {% block content %} 5 |
6 |
7 | {% csrf_token %} 8 |
9 | {% if messages %} 10 |
    11 | {% for message in messages %} 12 |
  • {{ message }}
  • 13 | {% endfor %} 14 |
15 | {% endif %} 16 |

17 | 18 | 19 |
20 |

21 |

22 | 23 | 24 |
25 |

26 |

27 | 28 | 29 |
30 | Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only. 31 |

32 |

33 | 34 | 35 |
36 |

37 |

38 | 39 | 40 | 41 |

    42 |
  • Your password must contain at least 8 characters.
  • 43 |
  • Your password can't be entirely numeric.
  • 44 |
45 | 46 |

47 |

48 | 49 | 50 |
51 | Enter the same password as before, for verification. 52 |

53 |
54 | 55 | {% if form.errors %} 56 | {% for field in form %} 57 | {% for error in field.errors %} 58 |
59 | {{ error|escape }} 60 |
61 | {% endfor %} 62 | {% endfor %} 63 | {% for error in form.non_field_errors %} 64 |
65 | {{ error|escape }} 66 |
67 | {% endfor %} 68 | {% endif %} 69 |
70 |
71 | {% endblock %} 72 | -------------------------------------------------------------------------------- /deductivereasoning/templates/submit.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | {% load static %} 3 | {% block title %}Submit Page{% endblock %} 4 | {% block content %} 5 | {% if user.is_authenticated %} 6 |
7 | {% csrf_token %} 8 |
9 |

Major argument:

10 | 14 | 15 | 16 | 20 | 21 |
22 | 23 |
24 |

Minor argument:

25 | 29 | 30 | 31 | 35 | 36 |
37 | 38 |
39 |

Conclusion:

40 | 44 | 46 | 47 | 51 | 53 |
54 | 55 | 56 | 57 |
58 | 59 |
60 | {% else %} 61 |

Please Login

62 | {% endif %} 63 | {% endblock %} 64 | {% block scripts %} 65 | 66 | {% endblock %} -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | django 2 | --------------------------------------------------------------------------------