-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added account creation and approval via email
- Loading branch information
Showing
28 changed files
with
426 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import django.apps | ||
|
||
|
||
class ApiConfig(django.apps.AppConfig): | ||
"""баззовый класс прилложения api""" | ||
|
||
default_auto_field = 'django.db.models.BigAutoField' | ||
name = 'api' | ||
verbose_name = 'апи' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import django.urls | ||
|
||
|
||
urlpatterns = [ | ||
django.urls.path('', django.urls.include('products.urls')), | ||
django.urls.re_path('auth/', django.urls.include('users.urls')), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import os | ||
|
||
import celery | ||
|
||
import django.conf | ||
|
||
|
||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'cfehome.settings') | ||
app = celery.Celery('cfehome', broker=django.conf.settings.CELERY_BROKER_URL) | ||
app.config_from_object('django.conf:settings', namespace='CELERY') | ||
app.autodiscover_tasks() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{% autoescape off %} | ||
Здравствуйте, {{ username }} | ||
Чтобы активировать свой аккаунт, пожалуйста, пройдите по ссылке ниже: | ||
|
||
{{ protocol }}://{{ domain }}{% url where_to uidb64=uid token=token %} | ||
|
||
С уважением, | ||
Администрация сайта bebrochka.ru | ||
{% endautoescape %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
from tests.fixtures.auth import ( | ||
from backend.cfehome.tests.fixtures.users import ( | ||
create_simple_user1, | ||
create_simple_user2, | ||
create_superuser, | ||
create_superuser | ||
) | ||
|
||
from tests.fixtures.products import ( | ||
create_private_product, | ||
create_public_product, | ||
create_public_product | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Generated by Django 4.2 on 2024-02-24 19:15 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
('users', '0002_alter_user_options'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='user', | ||
name='email', | ||
field=models.EmailField( | ||
max_length=254, verbose_name='email address' | ||
), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import rest_framework.permissions | ||
|
||
import django.http | ||
|
||
import users.models | ||
|
||
|
||
class IsAdminOrIsSelf(rest_framework.permissions.BasePermission): | ||
""" | ||
проверяем возможность пользователя смотреть, | ||
редактировать и изменять пользователя | ||
""" | ||
|
||
methods = { | ||
'PUT': 'change', | ||
'PATCH': 'change', | ||
'DELETE': 'delete', | ||
'GET': 'view', | ||
} | ||
|
||
def has_object_permission( | ||
self, | ||
request: django.http.HttpRequest, | ||
view: rest_framework.views.APIView, | ||
obj: users.models.User, | ||
): | ||
user = request.user | ||
if not user: | ||
return False | ||
if ( | ||
user.pk == obj.pk | ||
or user.is_staff | ||
and user.has_perm(f'users.{self.methods[request.method]}_user') | ||
): | ||
return True | ||
return False |
Oops, something went wrong.