-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Ahmed IIbrahim
committed
Oct 4, 2024
1 parent
dff093c
commit 0fbf4c0
Showing
42 changed files
with
223 additions
and
3 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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,41 @@ | ||
from django.contrib import admin | ||
from django.contrib.auth.admin import UserAdmin | ||
from blango_auth.models import User | ||
from django.utils.translation import gettext_lazy as _ | ||
# Register your models here. | ||
|
||
|
||
class BlangoUserAdmin(UserAdmin): | ||
fieldsets = ( | ||
(None, {"fields": ("email", "password")}), | ||
(_("Personal info"), {"fields": ("first_name", "last_name")}), | ||
( | ||
_("Permissions"), | ||
{ | ||
"fields": ( | ||
"is_active", | ||
"is_staff", | ||
"is_superuser", | ||
"groups", | ||
"user_permissions", | ||
) | ||
}, | ||
), | ||
(_("Important dates"), {"fields": ("last_login", "date_joined")}), | ||
) | ||
add_fieldsets = ( | ||
( | ||
None, | ||
{ | ||
"classes": ("wide",), | ||
"fields": ("email", "password1", "password2"), | ||
}, | ||
), | ||
) | ||
list_display = ("email", "first_name", "last_name", "is_staff") | ||
search_fields = ("email", "first_name", "last_name") | ||
ordering = ("email",) | ||
|
||
|
||
|
||
admin.site.register(User, BlangoUserAdmin) |
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,6 @@ | ||
from django.apps import AppConfig | ||
|
||
|
||
class BlangoAuthConfig(AppConfig): | ||
default_auto_field = 'django.db.models.BigAutoField' | ||
name = 'blango_auth' |
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,44 @@ | ||
# Generated by Django 3.2.6 on 2024-09-30 03:03 | ||
|
||
import django.contrib.auth.models | ||
import django.contrib.auth.validators | ||
from django.db import migrations, models | ||
import django.utils.timezone | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
initial = True | ||
|
||
dependencies = [ | ||
('auth', '0012_alter_user_first_name_max_length'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='User', | ||
fields=[ | ||
('id', models.BigAutoField(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')), | ||
('username', models.CharField(error_messages={'unique': 'A user with that username already exists.'}, help_text='Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.', max_length=150, unique=True, validators=[django.contrib.auth.validators.UnicodeUsernameValidator()], verbose_name='username')), | ||
('first_name', models.CharField(blank=True, max_length=150, 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')), | ||
('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()), | ||
], | ||
), | ||
] |
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,29 @@ | ||
# Generated by Django 3.2.6 on 2024-10-04 01:14 | ||
|
||
import blango_auth.models | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('blango_auth', '0001_initial'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterModelManagers( | ||
name='user', | ||
managers=[ | ||
('objects', blango_auth.models.BlangoUserManager()), | ||
], | ||
), | ||
migrations.RemoveField( | ||
model_name='user', | ||
name='username', | ||
), | ||
migrations.AlterField( | ||
model_name='user', | ||
name='email', | ||
field=models.EmailField(max_length=254, unique=True, verbose_name='email address'), | ||
), | ||
] |
Empty file.
Binary file not shown.
Binary file added
BIN
+806 Bytes
blango_auth/migrations/__pycache__/0002_auto_20241004_0114.cpython-36.pyc
Binary file not shown.
Binary file not shown.
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,48 @@ | ||
from django.db import models | ||
from django.contrib.auth.models import AbstractUser, UserManager | ||
from django.utils.translation import gettext_lazy as _ | ||
|
||
|
||
# Create your models here. | ||
class BlangoUserManager(UserManager): | ||
def _create_user(self, email, password, **extra_fields): | ||
if not email: | ||
raise ValueError("Email must be set") | ||
email = self.normalize_email(email) | ||
user = self.model(email=email, **extra_fields) | ||
user.set_password(password) | ||
user.save(using=self._db) | ||
return user | ||
|
||
def create_user(self, email, password=None, **extra_fields): | ||
extra_fields.setdefault("is_staff", False) | ||
extra_fields.setdefault("is_superuser", False) | ||
return self._create_user(email, password, **extra_fields) | ||
|
||
def create_superuser(self, email, password, **extra_fields): | ||
extra_fields.setdefault("is_staff", True) | ||
extra_fields.setdefault("is_superuser", True) | ||
|
||
if extra_fields.get("is_staff") is not True: | ||
raise ValueError("Superuser must have is_staff=True.") | ||
if extra_fields.get("is_superuser") is not True: | ||
raise ValueError("Superuser must have is_superuser=True.") | ||
|
||
return self._create_user(email, password, **extra_fields) | ||
|
||
|
||
|
||
class User(AbstractUser): | ||
username = None | ||
email = models.EmailField( | ||
_("email address"), | ||
unique=True, | ||
) | ||
|
||
objects = BlangoUserManager() | ||
|
||
USERNAME_FIELD = "email" | ||
REQUIRED_FIELDS = [] | ||
|
||
def __str__(self): | ||
return self.email |
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,3 @@ | ||
from django.test import TestCase | ||
|
||
# Create your tests here. |
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,3 @@ | ||
from django.shortcuts import render | ||
|
||
# Create your views here. |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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,10 +1,11 @@ | ||
from django.contrib import admin | ||
from blog.models import Tag, Post, Comment | ||
from blog.models import Tag, Post, Comment, AuthorProfile | ||
|
||
class PostAdmin(admin.ModelAdmin): | ||
prepopulated_fields = {"slug": ["title"]} | ||
|
||
# Register your models here. | ||
admin.site.register(Tag) | ||
admin.site.register(Post, PostAdmin) | ||
admin.site.register(Comment) | ||
admin.site.register(Comment) | ||
admin.site.register(AuthorProfile) |
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,24 @@ | ||
# Generated by Django 3.2.6 on 2024-09-30 03:15 | ||
|
||
from django.conf import settings | ||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
('blog', '0005_auto_20240924_1811'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='AuthorProfile', | ||
fields=[ | ||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('bio', models.TextField()), | ||
('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='profile', to=settings.AUTH_USER_MODEL)), | ||
], | ||
), | ||
] |
Binary file not shown.
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
blog/migrations/__pycache__/0003_auto_20240907_1018.cpython-36.pyc
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
blog/migrations/__pycache__/0004_alter_post_published_at.cpython-36.pyc
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
blog/migrations/__pycache__/0005_auto_20240924_1811.cpython-36.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
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
Binary file not shown.
Binary file not shown.
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 @@ | ||
[{"model": "blog.comment", "pk": 2, "fields": {"creator": 1, "content": "I like myself!", "content_type": 4, "object_id": 1, "created_at": "2024-09-07T13:35:22.696Z", "modified_at": "2024-09-07T13:35:22.713Z"}}, {"model": "blog.comment", "pk": 3, "fields": {"creator": 3, "content": "wonderfull!", "content_type": 8, "object_id": 1, "created_at": "2024-09-08T19:09:55.378Z", "modified_at": "2024-09-08T19:09:55.378Z"}}, {"model": "blog.comment", "pk": 4, "fields": {"creator": 3, "content": "great", "content_type": 8, "object_id": 2, "created_at": "2024-09-08T19:10:09.602Z", "modified_at": "2024-09-08T19:10:09.602Z"}}, {"model": "blog.comment", "pk": 5, "fields": {"creator": 3, "content": "Continue", "content_type": 8, "object_id": 1, "created_at": "2024-09-09T10:31:59.631Z", "modified_at": "2024-09-09T10:31:59.631Z"}}, {"model": "blog.tag", "pk": 1, "fields": {"value": "django"}}, {"model": "blog.post", "pk": 1, "fields": {"author": 2, "created_at": "2024-09-05T08:09:59.307Z", "modified_at": "2024-09-07T13:15:47.999Z", "published_at": "2024-09-05T08:08:42Z", "title": "An Example Post", "slug": "an-example-post", "summary": "A short example post", "content": "example", "tags": [1]}}, {"model": "blog.post", "pk": 2, "fields": {"author": 1, "created_at": "2024-09-07T11:41:00.421Z", "modified_at": "2024-09-07T11:41:00.421Z", "published_at": "2024-09-07T11:31:34Z", "title": "No Pain No Gain", "slug": "no-pain-no-gain", "summary": "just make your best and all will be fine", "content": "Tell me why\r\nShould I let you go, go, go, go\r\nYou know I love you so, so, so, so\r\nThat's why I am here tonight\r\nSo put your hands up\r\nWhy shouldn't I flow, flow, flow, flow?\r\nAnd pump it up on stereo, oh, oh, oh, oh\r\nIt's time to stomp on five\r\n\r\nLadies and gentlemen, the 89ers are back, come on, let's go!\r\n\r\n(Whoo-oo)\r\n(Whoo-oo)\r\n(Whoo-oo)\r\n(Whoo-oo)\r\n\r\nThis song's for you and that's no lie\r\nYou can't imagine, how hard I really try\r\nTo satisfy you everyday\r\nAnd all that you do is coming at me\r\nYou doing it like a killer-bee\r\nHey, hey, it's alright\r\nWe have to stop our feeling-fight\r\nOh, oh, you take my hand\r\n89ers is a punk tend band\r\n\r\nPlease tell me why should I let you go, go, go, go\r\nBecause I love you so, so, so, so\r\nThat's why I'm here tonight\r\nSo put your hands up\r\nWhy shouldn't I let it flow flow flow?\r\nAnd pump it up the stereo, oh, oh, oh, oh\r\nIt's time to stop the fight!\r\n\r\nCome with me, let's go for a ride\r\nFollow me to the brighter side\r\nPretty girl, just look around\r\nThat everybody is jumping around to the 89ers sound\r\nHey, hey, what's that noise?\r\nRushing into ears of the girls and the boys\r\nOh, oh, enjoy the show\r\nThat the 89ers never punchline flow\r\n\r\nPlease tell me why should I let you go, go, go, go\r\nBecause I love you so, so, so, so\r\nThat's why I'm here tonight\r\nSo put your hands up\r\nWhy shouldn't I let it flow flow flow?\r\nAnd pump it up the stereo, oh, oh, oh\r\nIt's time to stop the fight!\r\n\r\n(Whoo-oo)\r\n(Whoo-oo)\r\n(Whoo-oo)\r\n(Whoo-oo)\r\n\r\nPlease tell me why should I let you go, go, go, go\r\nBecause I love you so, so, so, so\r\nThat's why I'm here tonight\r\nSo put your hands up\r\nWhy shouldn't I let it flow flow flow?\r\nAnd pump it up the stereo, oh, oh, oh\r\nIt's time to stop the fight!\r\n\r\n\r\nAdd to favorites\r\n\r\nAdd to playlist\r\n\r\nFont size\r\nTab\r\nPrint\r\nCorrect\r\n\r\nAuto-scroll", "tags": [1]}}, {"model": "blango_auth.user", "pk": 1, "fields": {"password": "pbkdf2_sha256$260000$o7DTh9eqqv0EimHkzb9BOM$0MliSxvL/HwG67CapZpOYf76V+tcWO5Us5YhznhOFnU=", "last_login": "2024-09-07T11:31:15Z", "is_superuser": true, "username": "Zoldycks", "first_name": "Hunter", "last_name": "Silva", "email": "[email protected]", "is_staff": true, "is_active": true, "date_joined": "2024-09-05T08:06:01Z", "groups": [], "user_permissions": []}}, {"model": "blango_auth.user", "pk": 2, "fields": {"password": "pbkdf2_sha256$260000$SXwqKRlvz3IboAkJygYyld$aIRu0FUj6qNJ59iAUNiP6nmWrU9L8nrOJGZGoqA3jyM=", "last_login": null, "is_superuser": false, "username": "codio", "first_name": "Ahmed", "last_name": "ibrahim", "email": "[email protected]", "is_staff": false, "is_active": true, "date_joined": "2024-09-07T13:14:21Z", "groups": [], "user_permissions": []}}, {"model": "blango_auth.user", "pk": 3, "fields": {"password": "pbkdf2_sha256$260000$ETPMU7VEJhLYaYU5AbjP9Y$2BMh0e9+fssUx1uWvF+Y74b5bZn/jkehc7zBLJJQk5w=", "last_login": "2024-09-08T19:09:22.333Z", "is_superuser": true, "username": "ahmed", "first_name": "", "last_name": "", "email": "[email protected]", "is_staff": true, "is_active": true, "date_joined": "2024-09-08T19:08:33.694Z", "groups": [], "user_permissions": []}}, {"model": "blango_auth.user", "pk": 4, "fields": {"password": "argon2$argon2id$v=19$m=102400,t=2,p=8$cTFXSzlYY014STRZQ01iY0RqSWxpNg$TtwXCIdBCNiwXF1UQ22yvA", "last_login": "2024-09-24T16:33:07.475Z", "is_superuser": true, "username": "Zoldyck", "first_name": "", "last_name": "", "email": "[email protected]", "is_staff": true, "is_active": true, "date_joined": "2024-09-17T15:42:15.364Z", "groups": [], "user_permissions": []}}] |
Binary file not shown.
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