Skip to content
Open

Done #13

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file.
3 changes: 3 additions & 0 deletions blogger_project/blogger/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.contrib import admin

# Register your models here.
5 changes: 5 additions & 0 deletions blogger_project/blogger/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from django.apps import AppConfig


class BloggerConfig(AppConfig):
name = 'blogger'
8 changes: 8 additions & 0 deletions blogger_project/blogger/forms.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from django import forms
from .models import Post


class PostForm(forms.ModelForm):
class Meta:
model = Post
fields = ['title', 'content', 'image', 'author', 'is_published']
24 changes: 24 additions & 0 deletions blogger_project/blogger/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Generated by Django 6.0.3 on 2026-04-15 08:30

from django.db import migrations, models


class Migration(migrations.Migration):

initial = True

dependencies = [
]

operations = [
migrations.CreateModel(
name='Post',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('title', models.CharField(max_length=2048)),
('content', models.TextField()),
('is_published', models.BooleanField(default=True)),
('published_at', models.DateTimeField(auto_now_add=True)),
],
),
]
18 changes: 18 additions & 0 deletions blogger_project/blogger/migrations/0002_post_image.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 6.0.3 on 2026-04-15 10:28

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('blogger', '0001_initial'),
]

operations = [
migrations.AddField(
model_name='post',
name='image',
field=models.ImageField(blank=True, null=True, upload_to='posts/'),
),
]
19 changes: 19 additions & 0 deletions blogger_project/blogger/migrations/0003_post_author.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Generated by Django 6.0.3 on 2026-04-16 02:08

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('blogger', '0002_post_image'),
]

operations = [
migrations.AddField(
model_name='post',
name='author',
field=models.CharField(default='Admin', max_length=100),
preserve_default=False,
),
]
Empty file.
97 changes: 97 additions & 0 deletions blogger_project/blogger/migrations/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
body {
background: #121212;
font-family: 'Segoe UI', Tahoma;
margin: 0;
}

/* navbar */
.navbar {
background: #1f1f1f;
padding: 15px 30px;
color: white;
display: flex;
justify-content: space-between;
align-items: center;
}

.navbar a {
margin-left: 10px;
padding: 8px 14px;
border-radius: 8px;
background: white;
text-decoration: none;
color: black;
font-weight: bold;
}

/* container (في النص) */
.container {
width: 40%;
margin: 80px auto;
text-align: left;
}

/* العناوين */
.section-title {
color: white;
font-size: 28px;
margin-bottom: 20px;
}

/* الكارد */
.post-card {
background: white;
border-radius: 12px;
padding: 20px;
margin-top: 20px;
box-shadow: 0 0 15px rgba(0,0,0,0.4);
}

/* الصور */
.post-card img {
width: 100%;
border-radius: 10px;
margin-bottom: 10px;
}

/* الفورم */
form {
background: #1e1e1e;
padding: 25px;
border-radius: 12px;
}

/* الليبل */
label {
color: white;
font-size: 18px;
}

/* المدخلات */
input, textarea {
width: 100%;
padding: 12px;
margin-top: 5px;
margin-bottom: 15px;
border-radius: 8px;
border: none;
font-size: 16px;
}

/* الزر */
button {
width: 100%;
padding: 12px;
background: #4e54c8;
color: white;
border: none;
border-radius: 8px;
font-size: 18px;
cursor: pointer;
}

/* النصوص الفارغة */
.no-posts {
color: white;
font-size: 18px;
}
14 changes: 14 additions & 0 deletions blogger_project/blogger/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from django.db import models

class Post(models.Model):
title = models.CharField(max_length=2048)
content = models.TextField()
is_published = models.BooleanField(default=True)
published_at = models.DateTimeField(auto_now_add=True)

image = models.ImageField(upload_to='posts/', blank=True, null=True)

author = models.CharField(max_length=100)

def __str__(self):
return self.title
Loading