├── README.md ├── requirements.txt └── todo ├── .70617373776f72642e747874 ├── .gitignore ├── db.sqlite3 ├── manage.py ├── static ├── css │ └── custom.css └── images │ ├── 17580.jpg │ ├── bolebole.gif │ ├── dexter.png │ ├── source.gif │ ├── tasker.png │ ├── test.jpg │ └── wa.png ├── tasks ├── __init__.py ├── __pycache__ │ ├── __init__.cpython-38.pyc │ ├── admin.cpython-38.pyc │ ├── models.cpython-38.pyc │ ├── serializers.cpython-38.pyc │ ├── tests.cpython-38.pyc │ ├── urls.cpython-38.pyc │ └── views.cpython-38.pyc ├── admin.py ├── apps.py ├── migrations │ ├── 0001_initial.py │ ├── 0002_task_priority.py │ ├── 0003_task_complete.py │ ├── 0004_auto_20180506_0853.py │ ├── 0005_auto_20180506_0932.py │ ├── 0006_auto_20180506_0940.py │ ├── 0007_auto_20180506_0946.py │ ├── 0008_auto_20180507_0326.py │ ├── 0009_auto_20180507_0328.py │ ├── 0010_auto_20200816_1820.py │ ├── __init__.py │ └── __pycache__ │ │ ├── 0001_initial.cpython-38.pyc │ │ ├── 0002_task_priority.cpython-38.pyc │ │ ├── 0003_task_complete.cpython-38.pyc │ │ ├── 0004_auto_20180506_0853.cpython-38.pyc │ │ ├── 0005_auto_20180506_0932.cpython-38.pyc │ │ ├── 0006_auto_20180506_0940.cpython-38.pyc │ │ ├── 0007_auto_20180506_0946.cpython-38.pyc │ │ ├── 0008_auto_20180507_0326.cpython-38.pyc │ │ ├── 0009_auto_20180507_0328.cpython-38.pyc │ │ ├── 0010_auto_20200816_1820.cpython-38.pyc │ │ └── __init__.cpython-38.pyc ├── models.py ├── serializers.py ├── templates │ ├── base.html │ ├── homepage.html │ ├── tasks.html │ └── token.html ├── templatetags │ ├── __pycache__ │ │ └── tags.cpython-38.pyc │ └── tags.py ├── tests.py ├── urls.py └── views.py └── todo ├── __init__.py ├── __pycache__ ├── __init__.cpython-38.pyc ├── settings.cpython-38.pyc ├── urls.cpython-38.pyc └── wsgi.cpython-38.pyc ├── settings.py ├── urls.py └── wsgi.py /README.md: -------------------------------------------------------------------------------- 1 | # errBox 2 | 3 |

Step 1: Clone the repo

4 |

Step 2: Run pip3 install -r requirements.txt

5 |

STep 3: Run python3 manage.py makemigrations

6 |

Step 4: Run python3 manage.py migrate

7 |

Step 5: Test whether the API GET request is working. Run python3 manage.py test. Should get OK as a response

8 |

Step 6: Run python3 manage.py runserver


9 | 10 |

Note: check solution.txt for missing dependencies/errors and ensure you're in the proper path to execute manage.py

-------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | # There might be a missing dependency ! 2 | pytz==2018.4 3 | -------------------------------------------------------------------------------- /todo/.70617373776f72642e747874: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VSevagen/errBox/47866a929f83da8409345b9ee9f7892760546ee0/todo/.70617373776f72642e747874 -------------------------------------------------------------------------------- /todo/.gitignore: -------------------------------------------------------------------------------- 1 | venv 2 | -------------------------------------------------------------------------------- /todo/db.sqlite3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VSevagen/errBox/47866a929f83da8409345b9ee9f7892760546ee0/todo/db.sqlite3 -------------------------------------------------------------------------------- /todo/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", "todo.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 | -------------------------------------------------------------------------------- /todo/static/css/custom.css: -------------------------------------------------------------------------------- 1 | .adanger{ 2 | color: #dc3545; /* red */ 3 | } 4 | 5 | .bwarning{ 6 | color: #ffc107; /* orange */ 7 | } 8 | 9 | .csuccess{ 10 | color: #28a745; /* green */ 11 | } 12 | 13 | .dprimary{ 14 | color: #007bff; /* blue */ 15 | } 16 | 17 | .adanger:hover{ 18 | color: #dc3545; /* red */ 19 | } 20 | 21 | .bwarning:hover{ 22 | color: #ffc107; /* orange */ 23 | } 24 | 25 | .csuccess:hover{ 26 | color: #28a745; /* green */ 27 | } 28 | 29 | .dprimary:hover{ 30 | color: #007bff; /* blue */ 31 | } 32 | -------------------------------------------------------------------------------- /todo/static/images/17580.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VSevagen/errBox/47866a929f83da8409345b9ee9f7892760546ee0/todo/static/images/17580.jpg -------------------------------------------------------------------------------- /todo/static/images/bolebole.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VSevagen/errBox/47866a929f83da8409345b9ee9f7892760546ee0/todo/static/images/bolebole.gif -------------------------------------------------------------------------------- /todo/static/images/dexter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VSevagen/errBox/47866a929f83da8409345b9ee9f7892760546ee0/todo/static/images/dexter.png -------------------------------------------------------------------------------- /todo/static/images/source.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VSevagen/errBox/47866a929f83da8409345b9ee9f7892760546ee0/todo/static/images/source.gif -------------------------------------------------------------------------------- /todo/static/images/tasker.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VSevagen/errBox/47866a929f83da8409345b9ee9f7892760546ee0/todo/static/images/tasker.png -------------------------------------------------------------------------------- /todo/static/images/test.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VSevagen/errBox/47866a929f83da8409345b9ee9f7892760546ee0/todo/static/images/test.jpg -------------------------------------------------------------------------------- /todo/static/images/wa.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VSevagen/errBox/47866a929f83da8409345b9ee9f7892760546ee0/todo/static/images/wa.png -------------------------------------------------------------------------------- /todo/tasks/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VSevagen/errBox/47866a929f83da8409345b9ee9f7892760546ee0/todo/tasks/__init__.py -------------------------------------------------------------------------------- /todo/tasks/__pycache__/__init__.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VSevagen/errBox/47866a929f83da8409345b9ee9f7892760546ee0/todo/tasks/__pycache__/__init__.cpython-38.pyc -------------------------------------------------------------------------------- /todo/tasks/__pycache__/admin.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VSevagen/errBox/47866a929f83da8409345b9ee9f7892760546ee0/todo/tasks/__pycache__/admin.cpython-38.pyc -------------------------------------------------------------------------------- /todo/tasks/__pycache__/models.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VSevagen/errBox/47866a929f83da8409345b9ee9f7892760546ee0/todo/tasks/__pycache__/models.cpython-38.pyc -------------------------------------------------------------------------------- /todo/tasks/__pycache__/serializers.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VSevagen/errBox/47866a929f83da8409345b9ee9f7892760546ee0/todo/tasks/__pycache__/serializers.cpython-38.pyc -------------------------------------------------------------------------------- /todo/tasks/__pycache__/tests.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VSevagen/errBox/47866a929f83da8409345b9ee9f7892760546ee0/todo/tasks/__pycache__/tests.cpython-38.pyc -------------------------------------------------------------------------------- /todo/tasks/__pycache__/urls.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VSevagen/errBox/47866a929f83da8409345b9ee9f7892760546ee0/todo/tasks/__pycache__/urls.cpython-38.pyc -------------------------------------------------------------------------------- /todo/tasks/__pycache__/views.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VSevagen/errBox/47866a929f83da8409345b9ee9f7892760546ee0/todo/tasks/__pycache__/views.cpython-38.pyc -------------------------------------------------------------------------------- /todo/tasks/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | from .models import Songs 3 | 4 | admin.site.register(Songs) 5 | -------------------------------------------------------------------------------- /todo/tasks/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class TasksConfig(AppConfig): 5 | name = 'tasks' 6 | -------------------------------------------------------------------------------- /todo/tasks/migrations/0001_initial.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.0.5 on 2018-05-03 09:49 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | initial = True 9 | 10 | dependencies = [ 11 | ] 12 | 13 | operations = [ 14 | migrations.CreateModel( 15 | name='Task', 16 | fields=[ 17 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 18 | ('title', models.CharField(max_length=200)), 19 | ('description', models.CharField(blank=True, max_length=1000)), 20 | ('date_of_creation', models.DateTimeField(auto_now_add=True)), 21 | ], 22 | ), 23 | ] 24 | -------------------------------------------------------------------------------- /todo/tasks/migrations/0002_task_priority.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.0.5 on 2018-05-04 10:14 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('tasks', '0001_initial'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='task', 15 | name='priority', 16 | field=models.CharField(choices=[('danger', 'Priority 1'), ('warning', 'Priority 2'), ('success', 'Priority 3'), ('primary', 'Priority 4')], default='danger', max_length=30), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /todo/tasks/migrations/0003_task_complete.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.0.4 on 2018-05-05 04:06 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('tasks', '0002_task_priority'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='task', 15 | name='complete', 16 | field=models.IntegerField(default=0), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /todo/tasks/migrations/0004_auto_20180506_0853.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.0.5 on 2018-05-06 08:53 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('tasks', '0003_task_complete'), 10 | ] 11 | 12 | operations = [ 13 | migrations.CreateModel( 14 | name='Username', 15 | fields=[ 16 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 17 | ('username', models.CharField(max_length=50)), 18 | ], 19 | ), 20 | migrations.AlterField( 21 | model_name='task', 22 | name='priority', 23 | field=models.CharField(choices=[('adanger', 'Priority 1'), ('bwarning', 'Priority 2'), ('csuccess', 'Priority 3'), ('dprimary', 'Priority 4')], default='adanger', max_length=30), 24 | ), 25 | ] 26 | -------------------------------------------------------------------------------- /todo/tasks/migrations/0005_auto_20180506_0932.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.0.5 on 2018-05-06 09:32 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('tasks', '0004_auto_20180506_0853'), 10 | ] 11 | 12 | operations = [ 13 | migrations.DeleteModel( 14 | name='Username', 15 | ), 16 | migrations.AddField( 17 | model_name='task', 18 | name='username', 19 | field=models.CharField(default='omkar', max_length=50, unique=True), 20 | preserve_default=False, 21 | ), 22 | ] 23 | -------------------------------------------------------------------------------- /todo/tasks/migrations/0006_auto_20180506_0940.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.0.5 on 2018-05-06 09:40 2 | 3 | from django.db import migrations, models 4 | import django.db.models.deletion 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('tasks', '0005_auto_20180506_0932'), 11 | ] 12 | 13 | operations = [ 14 | migrations.CreateModel( 15 | name='Username', 16 | fields=[ 17 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 18 | ('username', models.CharField(max_length=50, unique=True)), 19 | ], 20 | ), 21 | migrations.AlterField( 22 | model_name='task', 23 | name='username', 24 | field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='tasks.Username'), 25 | ), 26 | ] 27 | -------------------------------------------------------------------------------- /todo/tasks/migrations/0007_auto_20180506_0946.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.0.5 on 2018-05-06 09:46 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('tasks', '0006_auto_20180506_0940'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='task', 15 | name='id', 16 | field=models.AutoField(primary_key=True, serialize=False), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /todo/tasks/migrations/0008_auto_20180507_0326.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.0.5 on 2018-05-07 03:26 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('tasks', '0007_auto_20180506_0946'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='task', 15 | name='priority', 16 | field=models.CharField(choices=[('adanger', 'Priority 1'), ('bwarning', 'Priority 2'), ('csuccess', 'Priority 3'), ('dprimary', 'Priority 4')], default='Select Priority', max_length=30), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /todo/tasks/migrations/0009_auto_20180507_0328.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.0.5 on 2018-05-07 03:28 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('tasks', '0008_auto_20180507_0326'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='task', 15 | name='priority', 16 | field=models.CharField(choices=[('adanger', 'Priority High'), ('bwarning', 'Priority Medium'), ('csuccess', 'Priority Low')], default='adanger', max_length=30), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /todo/tasks/migrations/0010_auto_20200816_1820.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.2 on 2020-08-16 18:20 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('tasks', '0009_auto_20180507_0328'), 10 | ] 11 | 12 | operations = [ 13 | migrations.CreateModel( 14 | name='Songs', 15 | fields=[ 16 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 17 | ('title', models.CharField(max_length=255)), 18 | ('artist', models.CharField(max_length=255)), 19 | ], 20 | ), 21 | migrations.DeleteModel( 22 | name='Task', 23 | ), 24 | migrations.DeleteModel( 25 | name='Username', 26 | ), 27 | ] 28 | -------------------------------------------------------------------------------- /todo/tasks/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VSevagen/errBox/47866a929f83da8409345b9ee9f7892760546ee0/todo/tasks/migrations/__init__.py -------------------------------------------------------------------------------- /todo/tasks/migrations/__pycache__/0001_initial.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VSevagen/errBox/47866a929f83da8409345b9ee9f7892760546ee0/todo/tasks/migrations/__pycache__/0001_initial.cpython-38.pyc -------------------------------------------------------------------------------- /todo/tasks/migrations/__pycache__/0002_task_priority.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VSevagen/errBox/47866a929f83da8409345b9ee9f7892760546ee0/todo/tasks/migrations/__pycache__/0002_task_priority.cpython-38.pyc -------------------------------------------------------------------------------- /todo/tasks/migrations/__pycache__/0003_task_complete.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VSevagen/errBox/47866a929f83da8409345b9ee9f7892760546ee0/todo/tasks/migrations/__pycache__/0003_task_complete.cpython-38.pyc -------------------------------------------------------------------------------- /todo/tasks/migrations/__pycache__/0004_auto_20180506_0853.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VSevagen/errBox/47866a929f83da8409345b9ee9f7892760546ee0/todo/tasks/migrations/__pycache__/0004_auto_20180506_0853.cpython-38.pyc -------------------------------------------------------------------------------- /todo/tasks/migrations/__pycache__/0005_auto_20180506_0932.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VSevagen/errBox/47866a929f83da8409345b9ee9f7892760546ee0/todo/tasks/migrations/__pycache__/0005_auto_20180506_0932.cpython-38.pyc -------------------------------------------------------------------------------- /todo/tasks/migrations/__pycache__/0006_auto_20180506_0940.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VSevagen/errBox/47866a929f83da8409345b9ee9f7892760546ee0/todo/tasks/migrations/__pycache__/0006_auto_20180506_0940.cpython-38.pyc -------------------------------------------------------------------------------- /todo/tasks/migrations/__pycache__/0007_auto_20180506_0946.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VSevagen/errBox/47866a929f83da8409345b9ee9f7892760546ee0/todo/tasks/migrations/__pycache__/0007_auto_20180506_0946.cpython-38.pyc -------------------------------------------------------------------------------- /todo/tasks/migrations/__pycache__/0008_auto_20180507_0326.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VSevagen/errBox/47866a929f83da8409345b9ee9f7892760546ee0/todo/tasks/migrations/__pycache__/0008_auto_20180507_0326.cpython-38.pyc -------------------------------------------------------------------------------- /todo/tasks/migrations/__pycache__/0009_auto_20180507_0328.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VSevagen/errBox/47866a929f83da8409345b9ee9f7892760546ee0/todo/tasks/migrations/__pycache__/0009_auto_20180507_0328.cpython-38.pyc -------------------------------------------------------------------------------- /todo/tasks/migrations/__pycache__/0010_auto_20200816_1820.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VSevagen/errBox/47866a929f83da8409345b9ee9f7892760546ee0/todo/tasks/migrations/__pycache__/0010_auto_20200816_1820.cpython-38.pyc -------------------------------------------------------------------------------- /todo/tasks/migrations/__pycache__/__init__.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VSevagen/errBox/47866a929f83da8409345b9ee9f7892760546ee0/todo/tasks/migrations/__pycache__/__init__.cpython-38.pyc -------------------------------------------------------------------------------- /todo/tasks/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | from django.forms import ModelForm 3 | from django import forms 4 | 5 | class Songs(models.Model): 6 | # song title 7 | title = models.charField(max_length=255, null=False) 8 | # name of artist or group/band 9 | artist = models.charField(max_length=255, null=False) 10 | 11 | def __str__(self): 12 | return "{} - {}".format(self.title, self.artist) 13 | -------------------------------------------------------------------------------- /todo/tasks/serializers.py: -------------------------------------------------------------------------------- 1 | from rest_framework import serializers 2 | from .models import Songs 3 | 4 | 5 | class SongsSerializer(serializers.ModelSerializer): 6 | class Meta: 7 | model = Songs 8 | fields = ("title") -------------------------------------------------------------------------------- /todo/tasks/templates/base.html: -------------------------------------------------------------------------------- 1 | 2 | {% load static %} 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | {% block title %}{% endblock %} 14 | 15 | 16 | 17 |
18 | {% block content %} 19 | 20 | {% endblock %} 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 | {% block javascript %}{% endblock %} 29 | 30 | 31 | -------------------------------------------------------------------------------- /todo/tasks/templates/homepage.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | {% load tags %} 3 | 4 | 5 | 6 | {% block content %} 7 |
8 |
9 |
10 | bolebole 11 |
12 |
13 |
14 |
15 |
16 |

Congratulation ! You were able to solve the issues in this game. Hope you were able to improve your googling skills while doing so !

17 | 18 | 19 | Click here to get token ! 20 | 21 |
22 |
23 |
24 |
25 | {% endblock %} 26 | -------------------------------------------------------------------------------- /todo/tasks/templates/tasks.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | {% load tags %} 3 | 4 | 5 | 6 | 7 | {% block content %} 8 |
9 |
10 |
11 | bolebole 12 |
13 |
14 |
15 |
16 |
17 |

Congratulation ! You were able to solve the issues in this game and generate random text. Hope you were able to improve your googling skills while doing so !

18 | 19 | 20 | Click here to get token ! 21 | 22 |
23 |
24 |
25 |
26 | {% endblock %} 27 | -------------------------------------------------------------------------------- /todo/tasks/templates/token.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | {% load tags %} 3 | {% load static %} 4 | 5 | {% block content %} 6 |
7 |
8 |
9 | bolebole 10 |
11 |
12 |
13 |
14 |
15 |

Password is {{password}}

16 |
17 |
18 |
19 |
20 | {% endblock %} -------------------------------------------------------------------------------- /todo/tasks/templatetags/__pycache__/tags.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VSevagen/errBox/47866a929f83da8409345b9ee9f7892760546ee0/todo/tasks/templatetags/__pycache__/tags.cpython-38.pyc -------------------------------------------------------------------------------- /todo/tasks/templatetags/tags.py: -------------------------------------------------------------------------------- 1 | from django import template 2 | 3 | register = template.Library() 4 | 5 | @register.filter(name='add_css') 6 | def add_css(field, css): 7 | """Removes all values of arg from the given string""" 8 | return field.as_widget(attrs={"class": css}) -------------------------------------------------------------------------------- /todo/tasks/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | from django.urls import reverse 3 | from rest_framework.test import APITestCase, APIClient 4 | from rest_framework.views import status 5 | from .models import Songs 6 | from .serializers import SongsSerializer 7 | 8 | class BaseViewTest(APITestCase): 9 | client = APIClient() 10 | 11 | @staticmethod 12 | def register_song(title="", artist=""): 13 | if title != "" and artist != "": 14 | Songs.objects.create(title=title, artist=artist) 15 | 16 | def setUp(self): 17 | # Test data. You cxan check out the songs if you want :) 18 | self.register_song("Mo Capitaine", "Michel Legris") 19 | self.register_song("Ici kot nu ete", "Cassiya") 20 | self.register_song("Bal Souki Souki", "Clarel Armel") 21 | 22 | 23 | class GetAllSongsTest(BaseViewTest): 24 | 25 | def test_get_all_songs(self): 26 | #Ensure the songs that were added through setup exist when a GET request is made. 27 | 28 | # hit the API endpoint 29 | response = self.client.get( 30 | reverse("songs-all", kwargs={"version": "v1"}) 31 | ) 32 | # Get the data from db 33 | expected = Songs.objects.all() 34 | serialized = SongsSerializer(expected, many=True) 35 | self.assertEqual(response.data, serialized.data) 36 | self.assertEqual(response.status_code, status.HTTP_200_OK) -------------------------------------------------------------------------------- /todo/tasks/urls.py: -------------------------------------------------------------------------------- 1 | """todo 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.urls import path, include 17 | from . import views 18 | 19 | urlpatterns = [ 20 | path('token/', views.token, name='get_token'), 21 | path('', views.homepage, name='homepage'), 22 | path('songs/', views.ListSongsView.as_view(), name="songs-all") 23 | ] 24 | -------------------------------------------------------------------------------- /todo/tasks/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render, redirect, reverse, render_to_response 2 | from django.http import HttpResponseRedirect,HttpResponse 3 | from django.template import RequestContext 4 | from rest_framework import generics 5 | from .models import Songs 6 | from .serializers import SongsSerializer 7 | import hashlib 8 | import random 9 | import string 10 | import os 11 | 12 | # Create your views here. 13 | def get_random_string(length): 14 | letters = string.ascii_lowercase 15 | result_str = ''.join(random.choice(letters) for i in range(length)) 16 | return result_str 17 | 18 | def homepage(request): 19 | return redirect('/songs') 20 | 21 | def token(request): 22 | test=".70617373776f72642e747874" 23 | filesize = os.path.getsize(".70617373776f72642e747874") 24 | if(filesize == 0): 25 | with open(test, 'wb') as f: 26 | p = get_random_string(11) 27 | f.write(p.encode("utf8")) 28 | else: 29 | with open(test, 'rb') as f: 30 | p = f.read() 31 | p = p.decode("utf8") 32 | print("Password has been generated !") 33 | return render(request, "token.html", {'password':p}) 34 | 35 | class ListSongsView(generics.ListAPIView): 36 | """ 37 | Provides a get method handler. 38 | """ 39 | queryset = Songs.objects.all() 40 | serializer_class = SongsSerializer 41 | -------------------------------------------------------------------------------- /todo/todo/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VSevagen/errBox/47866a929f83da8409345b9ee9f7892760546ee0/todo/todo/__init__.py -------------------------------------------------------------------------------- /todo/todo/__pycache__/__init__.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VSevagen/errBox/47866a929f83da8409345b9ee9f7892760546ee0/todo/todo/__pycache__/__init__.cpython-38.pyc -------------------------------------------------------------------------------- /todo/todo/__pycache__/settings.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VSevagen/errBox/47866a929f83da8409345b9ee9f7892760546ee0/todo/todo/__pycache__/settings.cpython-38.pyc -------------------------------------------------------------------------------- /todo/todo/__pycache__/urls.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VSevagen/errBox/47866a929f83da8409345b9ee9f7892760546ee0/todo/todo/__pycache__/urls.cpython-38.pyc -------------------------------------------------------------------------------- /todo/todo/__pycache__/wsgi.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VSevagen/errBox/47866a929f83da8409345b9ee9f7892760546ee0/todo/todo/__pycache__/wsgi.cpython-38.pyc -------------------------------------------------------------------------------- /todo/todo/settings.py: -------------------------------------------------------------------------------- 1 | """ 2 | Django settings for todo project. 3 | 4 | Generated by 'django-admin startproject' using Django 2.0.4. 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 | 19 | # Quick-start development settings - unsuitable for production 20 | # See https://docs.djangoproject.com/en/2.0/howto/deployment/checklist/ 21 | 22 | # SECURITY WARNING: keep the secret key used in production secret! 23 | SECRET_KEY = '0*$jmq3(h$)w-us0g6uz*!(k%-x1j-+pmo%r)oky^h1491o60#' 24 | 25 | # SECURITY WARNING: don't run with debug turned on in production! 26 | DEBUG = True 27 | 28 | ALLOWED_HOSTS = ['*'] 29 | 30 | 31 | # Application definition 32 | 33 | INSTALLED_APPS = [ 34 | 'django.contrib.admin', 35 | 'django.contrib.auth', 36 | 'django.contrib.contenttypes', 37 | 'django.contrib.sessions', 38 | 'django.contrib.messages', 39 | 'django.contrib.staticfiles', 40 | 'rest_framework' 41 | ] 42 | 43 | MIDDLEWARE = [ 44 | 'django.middleware.security.SecurityMiddleware', 45 | 'django.contrib.sessions.middleware.SessionMiddleware', 46 | 'django.middleware.common.CommonMiddleware', 47 | 'django.middleware.csrf.CsrfViewMiddleware', 48 | 'django.contrib.auth.middleware.AuthenticationMiddleware', 49 | 'django.contrib.messages.middleware.MessageMiddleware', 50 | 'django.middleware.clickjacking.XFrameOptionsMiddleware', 51 | ] 52 | 53 | ROOT_URLCONF = 'todo.urls' 54 | 55 | TEMPLATES = [ 56 | { 57 | 'BACKEND': 'django.template.backends.django.DjangoTemplates', 58 | 'DIRS': [os.path.join(BASE_DIR, 'templates')], 59 | 'APP_DIRS': True, 60 | 'OPTIONS': { 61 | 'context_processors': [ 62 | 'django.template.context_processors.debug', 63 | 'django.template.context_processors.request', 64 | 'django.contrib.auth.context_processors.auth', 65 | 'django.contrib.messages.context_processors.messages', 66 | ], 67 | }, 68 | }, 69 | ] 70 | 71 | WSGI_APPLICATION = 'todo.wsgi.application' 72 | 73 | 74 | # Database 75 | # https://docs.djangoproject.com/en/2.0/ref/settings/#databases 76 | 77 | DATABASES = { 78 | 'default': { 79 | 'ENGINE': 'django.db.backends.sqlite3', 80 | 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), 81 | } 82 | } 83 | 84 | 85 | # Password validation 86 | # https://docs.djangoproject.com/en/2.0/ref/settings/#auth-password-validators 87 | 88 | AUTH_PASSWORD_VALIDATORS = [ 89 | { 90 | 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', 91 | }, 92 | { 93 | 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', 94 | }, 95 | { 96 | 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', 97 | }, 98 | { 99 | 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', 100 | }, 101 | ] 102 | 103 | 104 | # Internationalization 105 | # https://docs.djangoproject.com/en/2.0/topics/i18n/ 106 | 107 | LANGUAGE_CODE = 'en-us' 108 | 109 | TIME_ZONE = 'UTC' 110 | 111 | USE_I18N = True 112 | 113 | USE_L10N = True 114 | 115 | USE_TZ = True 116 | 117 | 118 | # Static files (CSS, JavaScript, Images) 119 | # https://docs.djangoproject.com/en/2.0/howto/static-files/ 120 | 121 | STATIC_URL = '/static/' 122 | 123 | STATICFILES_DIRS = [ 124 | os.path.join(BASE_DIR, 'static'), 125 | ] 126 | -------------------------------------------------------------------------------- /todo/todo/urls.py: -------------------------------------------------------------------------------- 1 | """todo 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, re_path 18 | 19 | urlpatterns = [ 20 | path('admin/', admin.site.urls), 21 | path('', include('tasks.urls')), 22 | re_path('api/(?P(v1|v2))/', include('tasks.urls')) 23 | ] 24 | -------------------------------------------------------------------------------- /todo/todo/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for todo 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", "todo.settings") 15 | 16 | application = get_wsgi_application() 17 | --------------------------------------------------------------------------------