forked from yahyaaly151989/Mastering_Django
-
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.
- Loading branch information
1 parent
15e3bbf
commit c2f7847
Showing
21 changed files
with
120 additions
and
12 deletions.
There are no files selected for viewing
Binary file modified
BIN
+489 Bytes
(310%)
Module04/bookmarks/account/__pycache__/admin.cpython-311.pyc
Binary file not shown.
Binary file modified
BIN
+1017 Bytes
(160%)
Module04/bookmarks/account/__pycache__/forms.cpython-311.pyc
Binary file not shown.
Binary file modified
BIN
+877 Bytes
(480%)
Module04/bookmarks/account/__pycache__/models.cpython-311.pyc
Binary file not shown.
Binary file modified
BIN
+73 Bytes
(110%)
Module04/bookmarks/account/__pycache__/urls.cpython-311.pyc
Binary file not shown.
Binary file modified
BIN
+1.15 KB
(180%)
Module04/bookmarks/account/__pycache__/views.cpython-311.pyc
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,3 +1,7 @@ | ||
from django.contrib import admin | ||
from .models import Profile | ||
|
||
# Register your models here. | ||
@admin.register(Profile) | ||
class ProfileAdmin(admin.ModelAdmin): | ||
list_display = ['user', 'date_of_birth', 'photo'] | ||
raw_id_fields = ['user'] |
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,26 @@ | ||
# Generated by Django 4.2.4 on 2023-09-22 05:52 | ||
|
||
from django.conf import settings | ||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
initial = True | ||
|
||
dependencies = [ | ||
migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='Profile', | ||
fields=[ | ||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('date_of_birth', models.DateField(blank=True, null=True)), | ||
('photo', models.ImageField(blank=True, upload_to='users/%Y/%m/%d/')), | ||
('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), | ||
], | ||
), | ||
] |
18 changes: 18 additions & 0 deletions
18
Module04/bookmarks/account/migrations/0002_alter_profile_photo.py
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,18 @@ | ||
# Generated by Django 4.2.4 on 2023-09-22 14:33 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('account', '0001_initial'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='profile', | ||
name='photo', | ||
field=models.ImageField(blank=True, upload_to='users/%Y/%m/%d'), | ||
), | ||
] |
Binary file added
BIN
+1.46 KB
Module04/bookmarks/account/migrations/__pycache__/0001_initial.cpython-311.pyc
Binary file not shown.
Binary file added
BIN
+844 Bytes
Module04/bookmarks/account/migrations/__pycache__/0002_alter_profile_photo.cpython-311.pyc
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,3 +1,11 @@ | ||
from django.db import models | ||
from django.conf import settings | ||
|
||
# Create your models here. | ||
class Profile(models.Model): | ||
user = models.OneToOneField(settings.AUTH_USER_MODEL, on_delete=models.CASCADE) | ||
|
||
date_of_birth = models.DateField(blank=True, null=True) | ||
photo = models.ImageField(upload_to='users/%Y/%m/%d', blank=True) | ||
|
||
def __str__(self): | ||
return f'Profile of {self.user.username}' |
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,14 @@ | ||
{% extends "base.html" %} | ||
|
||
{% block title %}Edit your account{% endblock %} | ||
|
||
{% block content %} | ||
<h1>Edit your account</h1> | ||
<p>You can edit your account using the following form:</p> | ||
<form method="post", enctype="multipart/form-data"> | ||
{{ user_form.as_p }} | ||
{{ profile_form.as_p }} | ||
{% csrf_token %} | ||
<p><input type="submit" value="Save changes"></p> | ||
</form> | ||
{% endblock %} |
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
Binary file modified
BIN
+67 Bytes
(100%)
Module04/bookmarks/bookmarks/__pycache__/settings.cpython-311.pyc
Binary file not shown.
Binary file modified
BIN
+303 Bytes
(160%)
Module04/bookmarks/bookmarks/__pycache__/urls.cpython-311.pyc
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
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,7 +1,13 @@ | ||
from django.contrib import admin | ||
from django.urls import path, include | ||
from django.conf import settings | ||
from django.conf.urls.static import static | ||
|
||
urlpatterns = [ | ||
path('admin/', admin.site.urls), | ||
path('account/', include('account.urls')), | ||
] | ||
|
||
if settings.DEBUG: | ||
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) | ||
|
Binary file not shown.