mirror of
https://github.com/Balshgit/public.git
synced 2026-02-04 10:00:39 +03:00
github stars project celery-rabbit
This commit is contained in:
0
new-github-repos/server/apps/__init__.py
Normal file
0
new-github-repos/server/apps/__init__.py
Normal file
0
new-github-repos/server/apps/main/__init__.py
Normal file
0
new-github-repos/server/apps/main/__init__.py
Normal file
8
new-github-repos/server/apps/main/admin.py
Normal file
8
new-github-repos/server/apps/main/admin.py
Normal file
@@ -0,0 +1,8 @@
|
||||
from django.contrib import admin
|
||||
|
||||
from server.apps.main.models import BlogPost
|
||||
|
||||
|
||||
@admin.register(BlogPost)
|
||||
class BlogPostAdmin(admin.ModelAdmin[BlogPost]):
|
||||
"""Admin panel example for ``BlogPost`` model."""
|
||||
11
new-github-repos/server/apps/main/logic/__init__.py
Normal file
11
new-github-repos/server/apps/main/logic/__init__.py
Normal file
@@ -0,0 +1,11 @@
|
||||
"""
|
||||
This package is a place for your business logic.
|
||||
|
||||
Please, do not create any other files inside your app package.
|
||||
Place all files here, including: logic, forms, serializers.
|
||||
|
||||
Decoupling is a good thing. We need more of that.
|
||||
|
||||
Try using https://github.com/dry-python/
|
||||
It is awesome for writing business logic!
|
||||
"""
|
||||
35
new-github-repos/server/apps/main/migrations/0001_initial.py
Normal file
35
new-github-repos/server/apps/main/migrations/0001_initial.py
Normal file
@@ -0,0 +1,35 @@
|
||||
# Generated by Django 2.2.7 on 2019-11-24 11:01
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
"""Initial migration that creates the example BlogPost model."""
|
||||
|
||||
initial = True
|
||||
dependencies = []
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='BlogPost',
|
||||
fields=[
|
||||
(
|
||||
'id',
|
||||
models.AutoField(
|
||||
auto_created=True,
|
||||
primary_key=True,
|
||||
serialize=False,
|
||||
verbose_name='ID',
|
||||
),
|
||||
),
|
||||
('title', models.CharField(max_length=80)),
|
||||
('body', models.TextField()),
|
||||
('created_at', models.DateTimeField(auto_now_add=True)),
|
||||
('updated_at', models.DateTimeField(auto_now=True)),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'BlogPost',
|
||||
'verbose_name_plural': 'BlogPosts',
|
||||
},
|
||||
),
|
||||
]
|
||||
33
new-github-repos/server/apps/main/models.py
Normal file
33
new-github-repos/server/apps/main/models.py
Normal file
@@ -0,0 +1,33 @@
|
||||
import textwrap
|
||||
from typing import Final, final
|
||||
|
||||
from django.db import models
|
||||
|
||||
#: That's how constants should be defined.
|
||||
_POST_TITLE_MAX_LENGTH: Final = 80
|
||||
|
||||
|
||||
@final
|
||||
class BlogPost(models.Model):
|
||||
"""
|
||||
This model is used just as an example.
|
||||
|
||||
With it we show how one can:
|
||||
- Use fixtures and factories
|
||||
- Use migrations testing
|
||||
|
||||
"""
|
||||
|
||||
title = models.CharField(max_length=_POST_TITLE_MAX_LENGTH)
|
||||
body = models.TextField()
|
||||
|
||||
created_at = models.DateTimeField(auto_now_add=True)
|
||||
updated_at = models.DateTimeField(auto_now=True)
|
||||
|
||||
class Meta(object):
|
||||
verbose_name = 'BlogPost' # You can probably use `gettext` for this
|
||||
verbose_name_plural = 'BlogPosts'
|
||||
|
||||
def __str__(self) -> str:
|
||||
"""All django models should have this method."""
|
||||
return textwrap.wrap(self.title, _POST_TITLE_MAX_LENGTH // 4)[0]
|
||||
29
new-github-repos/server/apps/main/static/main/css/index.css
Normal file
29
new-github-repos/server/apps/main/static/main/css/index.css
Normal file
@@ -0,0 +1,29 @@
|
||||
body {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
img {
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.wemake-services-body {
|
||||
height: 95vh;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.wemake-services-logo {
|
||||
max-width: 250px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.github-corner img {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
border: 0;
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 5.8 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 8.6 KiB |
46
new-github-repos/server/apps/main/templates/main/index.html
Normal file
46
new-github-repos/server/apps/main/templates/main/index.html
Normal file
File diff suppressed because one or more lines are too long
9
new-github-repos/server/apps/main/urls.py
Normal file
9
new-github-repos/server/apps/main/urls.py
Normal file
@@ -0,0 +1,9 @@
|
||||
from django.urls import path
|
||||
|
||||
from server.apps.main.views import index
|
||||
|
||||
app_name = 'main'
|
||||
|
||||
urlpatterns = [
|
||||
path('hello/', index, name='hello'),
|
||||
]
|
||||
12
new-github-repos/server/apps/main/views.py
Normal file
12
new-github-repos/server/apps/main/views.py
Normal file
@@ -0,0 +1,12 @@
|
||||
from django.http import HttpRequest, HttpResponse
|
||||
from django.shortcuts import render
|
||||
|
||||
|
||||
def index(request: HttpRequest) -> HttpResponse:
|
||||
"""
|
||||
Main (or index) view.
|
||||
|
||||
Returns rendered default page to the user.
|
||||
Typed with the help of ``django-stubs`` project.
|
||||
"""
|
||||
return render(request, 'main/index.html')
|
||||
Reference in New Issue
Block a user