Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
42 changes: 0 additions & 42 deletions .gitignore

This file was deleted.

7 changes: 7 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/smarturlprj.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

443 changes: 443 additions & 0 deletions .idea/workspace.xml

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM python:3.8

ENV PYTHONUNBUFFERED 1

RUN mkdir /smarturl

WORKDIR /smarturl

COPY requirements.txt /smarturl/

RUN pip install --upgrade pip && pip install -r requirements.txt

ADD . /smarturl/
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: gunicorn smarturlprj.wsgi --log-file -
Binary file added accounts/__pycache__/__init__.cpython-37.pyc
Binary file not shown.
Binary file added accounts/__pycache__/__init__.cpython-39.pyc
Binary file not shown.
Binary file added accounts/__pycache__/admin.cpython-37.pyc
Binary file not shown.
Binary file added accounts/__pycache__/admin.cpython-39.pyc
Binary file not shown.
Binary file added accounts/__pycache__/forms.cpython-37.pyc
Binary file not shown.
Binary file added accounts/__pycache__/forms.cpython-39.pyc
Binary file not shown.
Binary file added accounts/__pycache__/models.cpython-37.pyc
Binary file not shown.
Binary file added accounts/__pycache__/models.cpython-39.pyc
Binary file not shown.
Binary file added accounts/__pycache__/multiform.cpython-37.pyc
Binary file not shown.
Binary file added accounts/__pycache__/urls.cpython-37.pyc
Binary file not shown.
Binary file added accounts/__pycache__/urls.cpython-39.pyc
Binary file not shown.
Binary file added accounts/__pycache__/utilities.cpython-37.pyc
Binary file not shown.
Binary file added accounts/__pycache__/utilities.cpython-39.pyc
Binary file not shown.
Binary file added accounts/__pycache__/validators.cpython-37.pyc
Binary file not shown.
Binary file added accounts/__pycache__/validators.cpython-39.pyc
Binary file not shown.
Binary file added accounts/__pycache__/views.cpython-37.pyc
Binary file not shown.
Binary file added accounts/__pycache__/views.cpython-39.pyc
Binary file not shown.
Binary file added accounts/migrations/.DS_Store
Binary file not shown.
50 changes: 50 additions & 0 deletions accounts/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Generated by Django 3.0.7 on 2020-09-27 16:47

import accounts.validators
import django.contrib.auth.models
from django.db import migrations, models
import django.utils.timezone


class Migration(migrations.Migration):

initial = True

dependencies = [
('auth', '0011_update_proxy_permissions'),
]

operations = [
migrations.CreateModel(
name='CustomUser',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('password', models.CharField(max_length=128, verbose_name='password')),
('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')),
('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')),
('first_name', models.CharField(blank=True, max_length=30, verbose_name='first name')),
('last_name', models.CharField(blank=True, max_length=150, verbose_name='last name')),
('email', models.EmailField(blank=True, max_length=254, verbose_name='email address')),
('is_staff', models.BooleanField(default=False, help_text='Designates whether the user can log into this admin site.', verbose_name='staff status')),
('is_active', models.BooleanField(default=True, help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.', verbose_name='active')),
('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')),
('username', models.CharField(error_messages={'unique': 'Этот логин занят. Попробуйте другой.'}, max_length=50, unique=True, validators=[accounts.validators.MyUsernameValidator()])),
('phone', models.CharField(blank=True, max_length=12)),
('age', models.PositiveIntegerField(default=0)),
('avatar', models.ImageField(blank=True, upload_to='images/users/')),
('title', models.CharField(blank=True, max_length=35)),
('description', models.CharField(blank=True, max_length=81)),
('is_activated', models.BooleanField(db_index=True, default=True, verbose_name='Прошел активизацию?')),
('groups', models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='user_set', related_query_name='user', to='auth.Group', verbose_name='groups')),
('user_permissions', models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.Permission', verbose_name='user permissions')),
],
options={
'verbose_name': 'user',
'verbose_name_plural': 'users',
'abstract': False,
},
managers=[
('objects', django.contrib.auth.models.UserManager()),
],
),
]
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added cardapp/.DS_Store
Binary file not shown.
Binary file added cardapp/__pycache__/__init__.cpython-37.pyc
Binary file not shown.
Binary file added cardapp/__pycache__/__init__.cpython-39.pyc
Binary file not shown.
Binary file added cardapp/__pycache__/admin.cpython-37.pyc
Binary file not shown.
Binary file added cardapp/__pycache__/admin.cpython-39.pyc
Binary file not shown.
Binary file added cardapp/__pycache__/apps.cpython-37.pyc
Binary file not shown.
Binary file added cardapp/__pycache__/forms.cpython-37.pyc
Binary file not shown.
Binary file added cardapp/__pycache__/forms.cpython-39.pyc
Binary file not shown.
Binary file added cardapp/__pycache__/models.cpython-37.pyc
Binary file not shown.
Binary file added cardapp/__pycache__/models.cpython-39.pyc
Binary file not shown.
Binary file added cardapp/__pycache__/serializers.cpython-37.pyc
Binary file not shown.
Binary file added cardapp/__pycache__/serializers.cpython-39.pyc
Binary file not shown.
Binary file added cardapp/__pycache__/urls.cpython-37.pyc
Binary file not shown.
Binary file added cardapp/__pycache__/urls.cpython-39.pyc
Binary file not shown.
Binary file added cardapp/__pycache__/views.cpython-37.pyc
Binary file not shown.
Binary file added cardapp/__pycache__/views.cpython-39.pyc
Binary file not shown.
Binary file added cardapp/migrations/.DS_Store
Binary file not shown.
135 changes: 135 additions & 0 deletions cardapp/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
# Generated by Django 3.0.7 on 2020-09-27 16:47

import colorfield.fields
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import embed_video.fields
import faicon.fields


class Migration(migrations.Migration):

initial = True

dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]

operations = [
migrations.CreateModel(
name='CreateBlock',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=100, verbose_name='Название блока')),
('close', models.BooleanField(default=False, verbose_name='Свернуть блок')),
('order', models.SmallIntegerField(db_index=True, default=0)),
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Пользователь')),
],
options={
'verbose_name': 'Мой раздел',
'verbose_name_plural': 'Мои разделы',
'ordering': ('order',),
},
),
migrations.CreateModel(
name='TableCategory',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('category', models.CharField(max_length=50)),
('block', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='blocktablecat', to='cardapp.CreateBlock')),
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Пользователь')),
],
options={
'verbose_name': 'Категория таблицы',
'verbose_name_plural': 'Категории таблицы',
},
),
migrations.CreateModel(
name='YoutubeVideo',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('url', embed_video.fields.EmbedVideoField(default='', help_text='Скопируйте и вставьте ссылку с youtube', verbose_name='Вставьте ссылку')),
('block', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='blockvideos', to='cardapp.CreateBlock')),
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Пользователь')),
],
),
migrations.CreateModel(
name='TableItems',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=50)),
('price', models.SmallIntegerField(default=0)),
('category', models.ForeignKey(blank=True, on_delete=django.db.models.deletion.CASCADE, related_name='tableitems', to='cardapp.TableCategory')),
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Пользователь')),
],
options={
'verbose_name': 'Содержимое таблицы',
'verbose_name_plural': 'Содержимое таблицы',
},
),
migrations.CreateModel(
name='CreateLink',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(help_text='Максимально 100 символов', max_length=100, verbose_name='Название')),
('status', models.IntegerField(choices=[(1, 'Обычная ссылка'), (2, 'Электронная почта'), (3, 'Номер телефона')], default=1, verbose_name='Тип ссылки')),
('url', models.CharField(help_text='Вставьте ссылку с пртоколом http:// или https://, если выбран тип электронной почты или телефона, то просто впишите вашу почту или номер телефона', max_length=900, verbose_name='Ссылка')),
('icon', faicon.fields.FAIconField(help_text='Выберите иконку', max_length=50, verbose_name='Иконка')),
('color_icon', colorfield.fields.ColorField(default='#FFF', help_text='Выберите цвет иконки', max_length=18, verbose_name='Цвет иконки')),
('color_bg', colorfield.fields.ColorField(default='#FF0000', help_text='Выберите цвет фона', max_length=18, verbose_name='Цвет фона')),
('order', models.SmallIntegerField(blank=True, db_index=True, default=0, help_text='Номер позиции в очереди', verbose_name='Позиция')),
('choose', models.BooleanField(default=True)),
('block', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='blocklinks', to='cardapp.CreateBlock')),
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Пользователь')),
],
options={
'verbose_name': 'Моя ссылка',
'verbose_name_plural': 'Мои ссылки',
'ordering': ('order',),
},
),
migrations.CreateModel(
name='CreateFaq',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('question', models.CharField(max_length=200)),
('answer', models.TextField()),
('order', models.SmallIntegerField(db_index=True, default=0)),
('block', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='blockfaq', to='cardapp.CreateBlock')),
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Пользователь')),
],
options={
'verbose_name': 'Вопрос-ответ',
'verbose_name_plural': 'Вопросы-ответы',
'ordering': ('order',),
},
),
migrations.CreateModel(
name='CardProfile',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('img', models.ImageField(blank=True, upload_to='images/%Y/%m/%d')),
('title', models.CharField(blank=True, max_length=35)),
('description', models.CharField(blank=True, max_length=81)),
('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
),
migrations.CreateModel(
name='Background',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('color_bg', colorfield.fields.ColorField(default='#FF0000', help_text='Выберите цвет фона', max_length=18, verbose_name='Цвет фона')),
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Пользователь')),
],
),
migrations.CreateModel(
name='AddImage',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('img', models.ImageField(help_text='Рекомендуем добавлять картинки одного размера', upload_to='images/%Y/%m/%d', verbose_name='Загрузите картинку')),
('block', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='blockimages', to='cardapp.CreateBlock')),
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Пользователь')),
],
),
]
24 changes: 24 additions & 0 deletions cardapp/migrations/0002_auto_20201206_1449.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Generated by Django 3.0.7 on 2020-12-06 14:49

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
('cardapp', '0001_initial'),
]

operations = [
migrations.AlterField(
model_name='tableitems',
name='category',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='tableitems', to='cardapp.TableCategory'),
),
migrations.AlterField(
model_name='tableitems',
name='price',
field=models.IntegerField(default=0),
),
]
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
7 changes: 7 additions & 0 deletions cardapp/serializers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from rest_framework import serializers
from .models import *

class BlockSerializer(serializers.ModelSerializer):
class Meta:
model = CreateBlock
fields = ("user", "name", "close", "order")
2 changes: 2 additions & 0 deletions cardapp/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@
urlpatterns = [
path('', views.index, name='index'),
path('<str:username>/', views.create_links, name='create_links'),
# api's
path("block/", views.BlockView.as_view()),
]
13 changes: 13 additions & 0 deletions cardapp/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
from accounts.models import CustomUser
from smarturlprj.settings import ALLOWED_HOSTS

from rest_framework.response import Response
from rest_framework.views import APIView
from .serializers import BlockSerializer

# Create your views here.
def index(request):
if ALLOWED_HOSTS:
Expand Down Expand Up @@ -43,3 +47,12 @@ def create_links(request, username):

return render(request, 'card.html', context)


# api's

class BlockView(APIView):
def get(self, request):
blocks = CreateBlock.objects.all()
serializer = BlockSerializer(blocks, many=True) # many-true для нескольких записей
return Response(serializer.data)

10 changes: 10 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: '3'

services:
web:
build: .
command: python manage.py runserver 0.0.0.0:8000
volumes:
- .:/smart_url
ports:
- '8000:8000'
Binary file added media/images/.DS_Store
Binary file not shown.
Binary file added media/images/2020/.DS_Store
Binary file not shown.
Binary file added media/images/default/icon-email.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/images/default/user.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/images/users/.DS_Store
Binary file not shown.
Binary file added media/images/users/face.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ django-colorfield==0.3.0
django-crispy-forms==1.9.1
django-embed-video==1.3.2
django-faicon==0.1.0
django-rest-framework==0.1.0
django-smart-selects==1.5.6
djangorestframework==3.12.4
gunicorn==20.0.4
idna==2.9
oauthlib==3.1.0
Pillow==7.1.2
Pillow==8.3.1
psycopg2-binary==2.8.6
pycparser==2.20
PyJWT==1.7.1
Expand Down
Binary file added smarturlprj/__pycache__/__init__.cpython-37.pyc
Binary file not shown.
Binary file added smarturlprj/__pycache__/__init__.cpython-39.pyc
Binary file not shown.
Binary file added smarturlprj/__pycache__/settings.cpython-37.pyc
Binary file not shown.
Binary file added smarturlprj/__pycache__/settings.cpython-39.pyc
Binary file not shown.
Binary file added smarturlprj/__pycache__/urls.cpython-37.pyc
Binary file not shown.
Binary file added smarturlprj/__pycache__/urls.cpython-39.pyc
Binary file not shown.
Binary file added smarturlprj/__pycache__/wsgi.cpython-37.pyc
Binary file not shown.
Binary file added smarturlprj/__pycache__/wsgi.cpython-39.pyc
Binary file not shown.
2 changes: 1 addition & 1 deletion smarturlprj/asgi.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
ASGI config for smarturlprj project.
ASGI .config for smarturlprj project.

It exposes the ASGI callable as a module-level variable named ``application``.

Expand Down
Loading