diff --git a/core/admin_working.py b/core/admin_working.py new file mode 100644 index 0000000..8e640ec --- /dev/null +++ b/core/admin_working.py @@ -0,0 +1,143 @@ +from django.contrib import admin +from .models import FAQ +from .models import Contact, SuccessStory, StoryReaction, Question, Answer, QuestionUpvote, AnswerUpvote + +@admin.register(Contact) +class ContactAdmin(admin.ModelAdmin): + list_display = ['first_name', 'last_name', 'email', 'subject', 'created_at'] + list_filter = ['created_at'] + search_fields = ['first_name', 'last_name', 'email', 'subject'] + readonly_fields = ['created_at'] + ordering = ['-created_at'] + + fieldsets = ( + ('Contact Information', { + 'fields': ('first_name', 'last_name', 'email', 'phone') + }), + ('Message Details', { + 'fields': ('subject', 'message') + }), + ('Timestamp', { + 'fields': ('created_at',) + }), + ) + + +@admin.register(SuccessStory) +class SuccessStoryAdmin(admin.ModelAdmin): + list_display = ('title', 'user', 'category', 'is_published', 'likes_count', 'created_at') + list_filter = ('category', 'is_published', 'created_at') + search_fields = ('title', 'content', 'user__username', 'user__first_name', 'user__last_name') + readonly_fields = ('likes_count', 'hearts_count', 'celebrations_count', 'created_at', 'updated_at') + list_editable = ('is_published',) + ordering = ('-created_at',) + + fieldsets = ( + ('Story Information', { + 'fields': ('user', 'title', 'content', 'category', 'tags') + }), + ('Publication', { + 'fields': ('is_published',) + }), + ('Statistics', { + 'fields': ('likes_count', 'hearts_count', 'celebrations_count'), + 'classes': ('collapse',) + }), + ('Timestamps', { + 'fields': ('created_at', 'updated_at'), + 'classes': ('collapse',) + }), + ) + +@admin.register(StoryReaction) +class StoryReactionAdmin(admin.ModelAdmin): + list_display = ('user', 'story', 'reaction_type', 'created_at') + list_filter = ('reaction_type', 'created_at') + search_fields = ('user__username', 'story__title') + ordering = ('-created_at',) + +@admin.register(Question) +class QuestionAdmin(admin.ModelAdmin): + list_display = ('title', 'user', 'subject', 'is_solved', 'upvotes_count', 'answers_count', 'created_at') + list_filter = ('subject', 'is_solved', 'created_at') + search_fields = ('title', 'description', 'user__username', 'user__first_name', 'user__last_name', 'tags') + readonly_fields = ('upvotes_count', 'created_at', 'updated_at') + list_editable = ('is_solved',) + ordering = ('-created_at',) + + fieldsets = ( + ('Question Information', { + 'fields': ('user', 'subject', 'title', 'description', 'tags') + }), + ('Status', { + 'fields': ('is_solved',) + }), + ('Statistics', { + 'fields': ('upvotes_count',), + 'classes': ('collapse',) + }), + ('Timestamps', { + 'fields': ('created_at', 'updated_at'), + 'classes': ('collapse',) + }), + ) + +@admin.register(Answer) +class AnswerAdmin(admin.ModelAdmin): + list_display = ('question_title', 'user', 'is_accepted', 'upvotes_count', 'created_at') + list_filter = ('is_accepted', 'created_at', 'question__subject') + search_fields = ('content', 'user__username', 'question__title') + readonly_fields = ('upvotes_count', 'created_at', 'updated_at') + list_editable = ('is_accepted',) + ordering = ('-created_at',) + + def question_title(self, obj): + return obj.question.title[:50] + '...' if len(obj.question.title) > 50 else obj.question.title + question_title.short_description = 'Question' + + fieldsets = ( + ('Answer Information', { + 'fields': ('user', 'question', 'content') + }), + ('Status', { + 'fields': ('is_accepted',) + }), + ('Statistics', { + 'fields': ('upvotes_count',), + 'classes': ('collapse',) + }), + ('Timestamps', { + 'fields': ('created_at', 'updated_at'), + 'classes': ('collapse',) + }), + ) + +@admin.register(QuestionUpvote) +class QuestionUpvoteAdmin(admin.ModelAdmin): + list_display = ('user', 'question_title', 'created_at') + list_filter = ('created_at',) + search_fields = ('user__username', 'question__title') + ordering = ('-created_at',) + + def question_title(self, obj): + return obj.question.title[:50] + '...' if len(obj.question.title) > 50 else obj.question.title + question_title.short_description = 'Question' + +@admin.register(AnswerUpvote) +class AnswerUpvoteAdmin(admin.ModelAdmin): + list_display = ('user', 'answer_preview', 'answer_author', 'created_at') + list_filter = ('created_at',) + search_fields = ('user__username', 'answer__content', 'answer__user__username') + ordering = ('-created_at',) + + def answer_preview(self, obj): + return obj.answer.content[:50] + '...' if len(obj.answer.content) > 50 else obj.answer.content + answer_preview.short_description = 'Answer Preview' + + def answer_author(self, obj): + return obj.answer.user.username + answer_author.short_description = 'Answer Author' + +@admin.register(FAQ) +class FAQAdmin(admin.ModelAdmin): + list_display = ('question', 'answer') \ No newline at end of file diff --git a/core/templates/index.html b/core/templates/index.html index 1afe671..a9b91d6 100644 --- a/core/templates/index.html +++ b/core/templates/index.html @@ -1,128 +1,103 @@ -{% extends "base.html" %} -{% block content %} - + .cta { background: linear-gradient(90deg, #00bfff, #0099cc); color: #fff; padding: 3rem 2rem; border-radius: 16px; margin: 2rem auto; } + + /* Background Orbs */ + .bg-orb { position: absolute; border-radius: 50%; opacity: 0.2; } + .bg-orb-1 { width: 200px; height: 200px; background: #00bfff; top: 10%; left: 5%; } + .bg-orb-2 { width: 300px; height: 300px; background: #0099cc; top: 40%; right: 10%; } + .bg-orb-3 { width: 150px; height: 150px; background: #00ffff; bottom: 20%; left: 20%; } + .bg-orb-4 { width: 250px; height: 250px; background: #00bfff; bottom: 10%; right: 15%; } + + /* Responsive */ + @media(max-width:768px) { + .hero h1 { font-size: 3rem; } + .features-grid, .steps, .community-grid { grid-template-columns: 1fr; } + .navbar { flex-direction: column; gap: 1rem; } + } + + + + + +
+
+
+
+ + + +

Welcome to PeerPrep

@@ -136,8 +111,7 @@

Welcome to PeerPrep

About PeerPrep

-

PeerPrep is a platform built to empower students and contributors through collaboration, structured learning, and real-time support. - Our mission is to make open-source and peer learning accessible, enjoyable, and impactful.

+

PeerPrep empowers students and contributors through collaboration, structured learning, and real-time support. Our mission is to make open-source and peer learning accessible, enjoyable, and impactful.

@@ -178,22 +152,22 @@

How It Works

-

1. Sign Up

+

Sign Up

Create your free account and join PeerPrep.

-

2. Join a Session

+

Join a Session

Collaborate with peers in real-time sessions.

-

3. Track Progress

+

Track Progress

Set learning goals and measure achievements.

-

4. Grow Together

+

Grow Together

Learn, share, and succeed as part of the community.

@@ -204,15 +178,9 @@

4. Grow Together

Our Community

We’re proud to be powered by contributors, learners, and mentors worldwide.

-
-

1000+ Active Learners

-
-
-

200+ Contributors

-
-
-

50+ Countries

-
+
1000+ Active Learners
+
200+ Contributors
+
50+ Countries
@@ -222,4 +190,10 @@

Start Your Learning Journey Today

Join PeerPrep and become part of a global collaborative learning community.

Sign Up Now -{% endblock %} + + + {% include "footer.html" %} + + + +