Forráskód Böngészése

Repository initialization

TonyKurts 11 hónapja
commit
912728e5ff
9 módosított fájl, 63 hozzáadás és 0 törlés
  1. 4 0
      .gitattributes
  2. 25 0
      .gitignore
  3. 3 0
      README.md
  4. 0 0
      __init__.py
  5. 3 0
      admin.py
  6. 6 0
      apps.py
  7. 16 0
      models.py
  8. 3 0
      tests.py
  9. 3 0
      views.py

+ 4 - 0
.gitattributes

@@ -0,0 +1,4 @@
+* text=auto
+
+*.txt text
+*.md text

+ 25 - 0
.gitignore

@@ -0,0 +1,25 @@
+# Virtualenv
+env/
+venv/
+
+# VSCode
+.vscode
+
+# Python
+__pycache__/
+*.py[cod]
+*$py.class
+
+# Django
+migrations/
+staticfiles/
+media/
+
+# Other
+*.sqlite3
+*.*~
+*.*.swp
+.DS_Store
+
+# Project configuration variables
+core/settings_vars.py

+ 3 - 0
README.md

@@ -0,0 +1,3 @@
+# ShariX Open User Model
+
+Basic user model of ShariX systems.

+ 0 - 0
__init__.py


+ 3 - 0
admin.py

@@ -0,0 +1,3 @@
+from django.contrib import admin
+
+# Register your models here.

+ 6 - 0
apps.py

@@ -0,0 +1,6 @@
+from django.apps import AppConfig
+
+
+class UserConfig(AppConfig):
+    default_auto_field = 'django.db.models.BigAutoField'
+    name = 'user'

+ 16 - 0
models.py

@@ -0,0 +1,16 @@
+from django.db import models
+from django.contrib.auth.models import AbstractUser
+
+
+class ShariXUser(AbstractUser):
+    phone_number = models.CharField(max_length=18, unique=True, verbose_name="Номер телефона")
+    avatar = models.ImageField(upload_to="useravatars/", null=True, blank=True, verbose_name="Аватар")
+
+    USERNAME_FIELD = "phone_number"
+
+    @property
+    def full_name(self):
+        if self.first_name and self.last_name:
+            return f"{self.first_name} {self.last_name}"
+        else:
+            return self.username

+ 3 - 0
tests.py

@@ -0,0 +1,3 @@
+from django.test import TestCase
+
+# Create your tests here.

+ 3 - 0
views.py

@@ -0,0 +1,3 @@
+from django.shortcuts import render
+
+# Create your views here.