diff --git a/myclass/myproject/db.sqlite3 b/myclass/myproject/db.sqlite3
new file mode 100644
index 0000000..0a8c1db
Binary files /dev/null and b/myclass/myproject/db.sqlite3 differ
diff --git a/myclass/myproject/manage.py b/myclass/myproject/manage.py
new file mode 100644
index 0000000..6a0e408
--- /dev/null
+++ b/myclass/myproject/manage.py
@@ -0,0 +1,22 @@
+#!/usr/bin/env python
+"""Django's command-line utility for administrative tasks."""
+import os
+import sys
+
+
+def main():
+ """Run administrative tasks."""
+ os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'myproject.settings')
+ try:
+ from django.core.management import execute_from_command_line
+ except ImportError as exc:
+ raise ImportError(
+ "Couldn't import Django. Are you sure it's installed and "
+ "available on your PYTHONPATH environment variable? Did you "
+ "forget to activate a virtual environment?"
+ ) from exc
+ execute_from_command_line(sys.argv)
+
+
+if __name__ == '__main__':
+ main()
diff --git a/myclass/myproject/myapp/__init__.py b/myclass/myproject/myapp/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/myclass/myproject/myapp/__pycache__/__init__.cpython-310.pyc b/myclass/myproject/myapp/__pycache__/__init__.cpython-310.pyc
new file mode 100644
index 0000000..ce84166
Binary files /dev/null and b/myclass/myproject/myapp/__pycache__/__init__.cpython-310.pyc differ
diff --git a/myclass/myproject/myapp/__pycache__/admin.cpython-310.pyc b/myclass/myproject/myapp/__pycache__/admin.cpython-310.pyc
new file mode 100644
index 0000000..d830d28
Binary files /dev/null and b/myclass/myproject/myapp/__pycache__/admin.cpython-310.pyc differ
diff --git a/myclass/myproject/myapp/__pycache__/apps.cpython-310.pyc b/myclass/myproject/myapp/__pycache__/apps.cpython-310.pyc
new file mode 100644
index 0000000..b337daa
Binary files /dev/null and b/myclass/myproject/myapp/__pycache__/apps.cpython-310.pyc differ
diff --git a/myclass/myproject/myapp/__pycache__/forms.cpython-310.pyc b/myclass/myproject/myapp/__pycache__/forms.cpython-310.pyc
new file mode 100644
index 0000000..73c1cb8
Binary files /dev/null and b/myclass/myproject/myapp/__pycache__/forms.cpython-310.pyc differ
diff --git a/myclass/myproject/myapp/__pycache__/models.cpython-310.pyc b/myclass/myproject/myapp/__pycache__/models.cpython-310.pyc
new file mode 100644
index 0000000..81444f6
Binary files /dev/null and b/myclass/myproject/myapp/__pycache__/models.cpython-310.pyc differ
diff --git a/myclass/myproject/myapp/__pycache__/urls.cpython-310.pyc b/myclass/myproject/myapp/__pycache__/urls.cpython-310.pyc
new file mode 100644
index 0000000..6b63d79
Binary files /dev/null and b/myclass/myproject/myapp/__pycache__/urls.cpython-310.pyc differ
diff --git a/myclass/myproject/myapp/__pycache__/views.cpython-310.pyc b/myclass/myproject/myapp/__pycache__/views.cpython-310.pyc
new file mode 100644
index 0000000..7e0e411
Binary files /dev/null and b/myclass/myproject/myapp/__pycache__/views.cpython-310.pyc differ
diff --git a/myclass/myproject/myapp/admin.py b/myclass/myproject/myapp/admin.py
new file mode 100644
index 0000000..45c4af1
--- /dev/null
+++ b/myclass/myproject/myapp/admin.py
@@ -0,0 +1,8 @@
+from django.contrib import admin
+
+# Register your models here.
+from .models import Room,Topic,Message
+
+admin.site.register(Room)
+admin.site.register(Topic)
+admin.site.register(Message)
\ No newline at end of file
diff --git a/myclass/myproject/myapp/apps.py b/myclass/myproject/myapp/apps.py
new file mode 100644
index 0000000..af1106d
--- /dev/null
+++ b/myclass/myproject/myapp/apps.py
@@ -0,0 +1,6 @@
+from django.apps import AppConfig
+
+
+class MyappConfig(AppConfig):
+ default_auto_field = 'django.db.models.BigAutoField'
+ name = 'myapp'
diff --git a/myclass/myproject/myapp/forms.py b/myclass/myproject/myapp/forms.py
new file mode 100644
index 0000000..9af50be
--- /dev/null
+++ b/myclass/myproject/myapp/forms.py
@@ -0,0 +1,8 @@
+from importlib.metadata import files
+from django.forms import ModelForm
+from .models import Room
+
+class RoomForm(ModelForm):
+ class Meta:
+ model=Room
+ fields='__all__'
\ No newline at end of file
diff --git a/myclass/myproject/myapp/migrations/0001_initial.py b/myclass/myproject/myapp/migrations/0001_initial.py
new file mode 100644
index 0000000..29662da
--- /dev/null
+++ b/myclass/myproject/myapp/migrations/0001_initial.py
@@ -0,0 +1,24 @@
+# Generated by Django 4.0.6 on 2022-08-27 17:36
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ initial = True
+
+ dependencies = [
+ ]
+
+ operations = [
+ migrations.CreateModel(
+ name='Room',
+ fields=[
+ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('name', models.CharField(max_length=40)),
+ ('desc', models.TextField(blank=True, null=True)),
+ ('update', models.DateTimeField(auto_now=True)),
+ ('created', models.DateTimeField(auto_now_add=True)),
+ ],
+ ),
+ ]
diff --git a/myclass/myproject/myapp/migrations/0002_topic_room_host_alter_room_name_message_room_topic.py b/myclass/myproject/myapp/migrations/0002_topic_room_host_alter_room_name_message_room_topic.py
new file mode 100644
index 0000000..ec35dcf
--- /dev/null
+++ b/myclass/myproject/myapp/migrations/0002_topic_room_host_alter_room_name_message_room_topic.py
@@ -0,0 +1,49 @@
+# Generated by Django 4.0.6 on 2022-08-28 11:10
+
+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),
+ ('myapp', '0001_initial'),
+ ]
+
+ operations = [
+ migrations.CreateModel(
+ name='Topic',
+ fields=[
+ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('name', models.CharField(max_length=300)),
+ ],
+ ),
+ migrations.AddField(
+ model_name='room',
+ name='host',
+ field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL),
+ ),
+ migrations.AlterField(
+ model_name='room',
+ name='name',
+ field=models.CharField(max_length=400),
+ ),
+ migrations.CreateModel(
+ name='Message',
+ fields=[
+ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('body', models.TextField()),
+ ('updated', models.DateTimeField(auto_now=True)),
+ ('created', models.DateTimeField(auto_now_add=True)),
+ ('room', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='myapp.room')),
+ ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
+ ],
+ ),
+ migrations.AddField(
+ model_name='room',
+ name='topic',
+ field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='myapp.topic'),
+ ),
+ ]
diff --git a/myclass/myproject/myapp/migrations/0003_room_participants.py b/myclass/myproject/myapp/migrations/0003_room_participants.py
new file mode 100644
index 0000000..66a125f
--- /dev/null
+++ b/myclass/myproject/myapp/migrations/0003_room_participants.py
@@ -0,0 +1,20 @@
+# Generated by Django 4.0.6 on 2022-11-29 15:21
+
+from django.conf import settings
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ migrations.swappable_dependency(settings.AUTH_USER_MODEL),
+ ('myapp', '0002_topic_room_host_alter_room_name_message_room_topic'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='room',
+ name='participants',
+ field=models.ManyToManyField(blank=True, related_name='participants', to=settings.AUTH_USER_MODEL),
+ ),
+ ]
diff --git a/myclass/myproject/myapp/migrations/0004_alter_room_options_rename_desc_room_description_and_more.py b/myclass/myproject/myapp/migrations/0004_alter_room_options_rename_desc_room_description_and_more.py
new file mode 100644
index 0000000..640ac46
--- /dev/null
+++ b/myclass/myproject/myapp/migrations/0004_alter_room_options_rename_desc_room_description_and_more.py
@@ -0,0 +1,27 @@
+# Generated by Django 4.0.6 on 2022-11-29 15:35
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('myapp', '0003_room_participants'),
+ ]
+
+ operations = [
+ migrations.AlterModelOptions(
+ name='room',
+ options={'ordering': ['updated', '-created']},
+ ),
+ migrations.RenameField(
+ model_name='room',
+ old_name='desc',
+ new_name='description',
+ ),
+ migrations.RenameField(
+ model_name='room',
+ old_name='update',
+ new_name='updated',
+ ),
+ ]
diff --git a/myclass/myproject/myapp/migrations/0005_rename_description_room_desc.py b/myclass/myproject/myapp/migrations/0005_rename_description_room_desc.py
new file mode 100644
index 0000000..18a72f2
--- /dev/null
+++ b/myclass/myproject/myapp/migrations/0005_rename_description_room_desc.py
@@ -0,0 +1,18 @@
+# Generated by Django 4.0.6 on 2022-11-29 15:45
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('myapp', '0004_alter_room_options_rename_desc_room_description_and_more'),
+ ]
+
+ operations = [
+ migrations.RenameField(
+ model_name='room',
+ old_name='description',
+ new_name='desc',
+ ),
+ ]
diff --git a/myclass/myproject/myapp/migrations/__init__.py b/myclass/myproject/myapp/migrations/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/myclass/myproject/myapp/migrations/__pycache__/0001_initial.cpython-310.pyc b/myclass/myproject/myapp/migrations/__pycache__/0001_initial.cpython-310.pyc
new file mode 100644
index 0000000..1198a88
Binary files /dev/null and b/myclass/myproject/myapp/migrations/__pycache__/0001_initial.cpython-310.pyc differ
diff --git a/myclass/myproject/myapp/migrations/__pycache__/0002_topic_room_host_alter_room_name_message_room_topic.cpython-310.pyc b/myclass/myproject/myapp/migrations/__pycache__/0002_topic_room_host_alter_room_name_message_room_topic.cpython-310.pyc
new file mode 100644
index 0000000..512140e
Binary files /dev/null and b/myclass/myproject/myapp/migrations/__pycache__/0002_topic_room_host_alter_room_name_message_room_topic.cpython-310.pyc differ
diff --git a/myclass/myproject/myapp/migrations/__pycache__/0003_room_participants.cpython-310.pyc b/myclass/myproject/myapp/migrations/__pycache__/0003_room_participants.cpython-310.pyc
new file mode 100644
index 0000000..4162927
Binary files /dev/null and b/myclass/myproject/myapp/migrations/__pycache__/0003_room_participants.cpython-310.pyc differ
diff --git a/myclass/myproject/myapp/migrations/__pycache__/0004_alter_room_options_rename_desc_room_description_and_more.cpython-310.pyc b/myclass/myproject/myapp/migrations/__pycache__/0004_alter_room_options_rename_desc_room_description_and_more.cpython-310.pyc
new file mode 100644
index 0000000..59bb2da
Binary files /dev/null and b/myclass/myproject/myapp/migrations/__pycache__/0004_alter_room_options_rename_desc_room_description_and_more.cpython-310.pyc differ
diff --git a/myclass/myproject/myapp/migrations/__pycache__/0005_rename_description_room_desc.cpython-310.pyc b/myclass/myproject/myapp/migrations/__pycache__/0005_rename_description_room_desc.cpython-310.pyc
new file mode 100644
index 0000000..5e40ca8
Binary files /dev/null and b/myclass/myproject/myapp/migrations/__pycache__/0005_rename_description_room_desc.cpython-310.pyc differ
diff --git a/myclass/myproject/myapp/migrations/__pycache__/__init__.cpython-310.pyc b/myclass/myproject/myapp/migrations/__pycache__/__init__.cpython-310.pyc
new file mode 100644
index 0000000..24d5fc4
Binary files /dev/null and b/myclass/myproject/myapp/migrations/__pycache__/__init__.cpython-310.pyc differ
diff --git a/myclass/myproject/myapp/models.py b/myclass/myproject/myapp/models.py
new file mode 100644
index 0000000..8fb7605
--- /dev/null
+++ b/myclass/myproject/myapp/models.py
@@ -0,0 +1,42 @@
+from tkinter import CASCADE
+from django.db import models
+from django.contrib.auth.models import User
+# from django.db.models.deletion import CASCADE
+
+# Create your models here.
+
+class Topic(models.Model):
+ name=models.CharField(max_length=300)
+
+ def __str__(self):
+ return self.name
+
+class Room(models.Model):
+ host=models.ForeignKey(User,on_delete=models.SET_NULL,null=True)
+ topic=models.ForeignKey(Topic,on_delete=models.SET_NULL,null=True)
+
+ name=models.CharField(max_length=400)
+ desc=models.TextField(null=True,blank=True)
+ participants=models.ManyToManyField(User,related_name='participants',blank=True)
+ updated=models.DateTimeField(auto_now=True)
+ created=models.DateTimeField(auto_now_add=True)
+
+ class Meta:
+ ordering=['updated','-created']
+
+ def __str__(self):
+ return self.name
+
+
+class Message(models.Model):
+ user=models.ForeignKey(User,on_delete=models.CASCADE)
+ room=models.ForeignKey(Room,on_delete=models.CASCADE)
+ body=models.TextField()
+ updated=models.DateTimeField(auto_now=True)
+ created=models.DateTimeField(auto_now_add=True)
+
+ class Meta:
+ ordering=['updated','-created']
+
+ def __str__(self):
+ return self.body[0:50]
\ No newline at end of file
diff --git a/myclass/myproject/myapp/templates/base/activity_component.html b/myclass/myproject/myapp/templates/base/activity_component.html
new file mode 100644
index 0000000..1a33ed5
--- /dev/null
+++ b/myclass/myproject/myapp/templates/base/activity_component.html
@@ -0,0 +1,14 @@
+
Recent Activity
+
+{% for message in room_messages %}
+
+
@{{message.user}} {{message.created|timesince}}
+
replied to "{{message.room}}"
+
+
{{message}}
+ {% if request.user == message.user %}
+
Delete
+ {% endif %}
+
+
+{% endfor %}
\ No newline at end of file
diff --git a/myclass/myproject/myapp/templates/base/delete.html b/myclass/myproject/myapp/templates/base/delete.html
new file mode 100644
index 0000000..b508503
--- /dev/null
+++ b/myclass/myproject/myapp/templates/base/delete.html
@@ -0,0 +1,13 @@
+{% extends 'main.html' %}
+
+{% block contant %}
+
+
+
+
+{% endblock contant %}
\ No newline at end of file
diff --git a/myclass/myproject/myapp/templates/base/feed_component.html b/myclass/myproject/myapp/templates/base/feed_component.html
new file mode 100644
index 0000000..96e4eaf
--- /dev/null
+++ b/myclass/myproject/myapp/templates/base/feed_component.html
@@ -0,0 +1,16 @@
+
+ {% for room in rooms %}
+
+ {% if request.user == room.host %}
+
Edit
+
delete
+ {% endif %}
+
+
@{{room.host.username}}
+
+
+
{{room.topic.name}}
+
+
+ {% endfor %}
+
\ No newline at end of file
diff --git a/myclass/myproject/myapp/templates/base/home.html b/myclass/myproject/myapp/templates/base/home.html
new file mode 100644
index 0000000..da93c0e
--- /dev/null
+++ b/myclass/myproject/myapp/templates/base/home.html
@@ -0,0 +1,34 @@
+{% extends 'main.html' %}
+
+
+{% block contant %}
+
+
+
+
+
+
+
+
+ {% include 'base/topics_component.html' %}
+
+
+
{{room_count}} rooms available
+
Create Room
+
+ {% include 'base/feed_component.html' %}
+
+
+
+ {% include 'base/activity_component.html' %}
+
+
+
+
+
+{% endblock %}
\ No newline at end of file
diff --git a/myclass/myproject/myapp/templates/base/login_register.html b/myclass/myproject/myapp/templates/base/login_register.html
new file mode 100644
index 0000000..4e2ca5f
--- /dev/null
+++ b/myclass/myproject/myapp/templates/base/login_register.html
@@ -0,0 +1,35 @@
+{% extends 'main.html' %}
+
+{% block contant %}
+
+{% if '"page"=="login"' %}
+
+
+
+
haven't signed up yet?
+
Sign Up
+
+
+{% else %}
+
+
+
Already signed up?
+
login
+
+{% endif %}
+{% endblock contant %}
\ No newline at end of file
diff --git a/myclass/myproject/myapp/templates/base/profile.html b/myclass/myproject/myapp/templates/base/profile.html
new file mode 100644
index 0000000..9036c0b
--- /dev/null
+++ b/myclass/myproject/myapp/templates/base/profile.html
@@ -0,0 +1,6 @@
+
\ No newline at end of file
diff --git a/myclass/myproject/myapp/templates/base/room.html b/myclass/myproject/myapp/templates/base/room.html
new file mode 100644
index 0000000..eddd702
--- /dev/null
+++ b/myclass/myproject/myapp/templates/base/room.html
@@ -0,0 +1,59 @@
+{% extends 'main.html' %}
+
+
+{% block contant %}
+
+
+
+
+
+
+
{{room.name}}
+
{{room.description}}
+
+
+
+ {% if request.user.is_authenticated %}
+
+ {% endif %}
+
+
+
participants
+
+
+ {% for user in participants %}
+
+
+ {% endfor %}
+
+
+
+{% endblock %}
\ No newline at end of file
diff --git a/myclass/myproject/myapp/templates/base/room_form.html b/myclass/myproject/myapp/templates/base/room_form.html
new file mode 100644
index 0000000..ceec884
--- /dev/null
+++ b/myclass/myproject/myapp/templates/base/room_form.html
@@ -0,0 +1,14 @@
+{% extends 'main.html' %}
+
+{% block contant %}
+
+
+
+
+{% endblock contant %}
+
+
diff --git a/myclass/myproject/myapp/templates/base/topics_component.html b/myclass/myproject/myapp/templates/base/topics_component.html
new file mode 100644
index 0000000..aa8227f
--- /dev/null
+++ b/myclass/myproject/myapp/templates/base/topics_component.html
@@ -0,0 +1,11 @@
+Browse Topic
+
+
+{% for topic in topics %}
+
+
+{% endfor %}
\ No newline at end of file
diff --git a/myclass/myproject/myapp/tests.py b/myclass/myproject/myapp/tests.py
new file mode 100644
index 0000000..de8bdc0
--- /dev/null
+++ b/myclass/myproject/myapp/tests.py
@@ -0,0 +1,3 @@
+from django.test import TestCase
+
+# Create your tests here.
diff --git a/myclass/myproject/myapp/urls.py b/myclass/myproject/myapp/urls.py
new file mode 100644
index 0000000..19593ff
--- /dev/null
+++ b/myclass/myproject/myapp/urls.py
@@ -0,0 +1,21 @@
+
+
+from django.urls import path
+from myapp import views
+
+urlpatterns = [
+
+ path('login/',views.loginpage,name='login'),
+ path('logout/',views.logoutUser,name='logout'),
+ path('register/',views.registerpage,name='register'),
+
+ path('',views.home,name="home"),
+ path('room//',views.room,name="room"),
+ # path('profile//',views.userProfile,name='user-Profile'),
+
+ path('create-Room/',views.createRoom,name="create-Room"),
+ path('update-Room//',views.updateRoom,name="update-Room"),
+ path('delete-Room//',views.deleteRoom,name="delete-Room"),
+ path('delete-message//',views.deleteMessage,name="delete-message")
+
+]
diff --git a/myclass/myproject/myapp/views.py b/myclass/myproject/myapp/views.py
new file mode 100644
index 0000000..6c8ed3b
--- /dev/null
+++ b/myclass/myproject/myapp/views.py
@@ -0,0 +1,161 @@
+from email import message
+# from http.client import HTTPResponse
+from django.http import HttpResponse
+from multiprocessing import context
+from django.shortcuts import render, redirect
+from .models import Room,Topic,Message
+from .forms import RoomForm
+from django.db.models import Q #used for incapsulation or wrap the parameters
+from django.contrib.auth import authenticate,login,logout
+from django.contrib.auth.models import User
+from django.contrib import messages
+from django.contrib.auth.decorators import login_required
+from django.contrib.auth.forms import UserCreationForm
+# Create your views here.
+
+# rooms=[
+# {'id':1,'name':'frontent developer'},
+# {'id':2,'name':'lets learn python!'},
+# {'id':3,'name':'design with me'},
+# ]
+
+
+def loginpage(request):
+ page='login'
+ if request.user.is_authenticated:
+ return redirect('home')
+ if request.method=="POST":
+ username=request.POST.get('username').lower()
+ password=request.POST.get('password')
+
+ try:
+ user=User.objects.get(username=username)
+
+ except:
+ messages.error(request,'user does not exist')
+
+ user= authenticate(request,username=username,password=password)
+
+
+ if user is not None:
+ login(request,user)
+ return redirect('home')
+ else:
+ messages.error(request,'Username or password does not Exist!')
+
+ context={'page':page}
+ return render(request,'base/login_register.html',context)
+
+def logoutUser(request):
+ logout(request)
+ return redirect('home')
+
+def registerpage(request):
+ form=UserCreationForm()
+
+ if request.method == 'POST':
+ form = UserCreationForm(request.POST)
+ if form.is_valid():
+ user = form.save(commit=False)
+ user.username = user.username.lower()
+ user.save()
+ login(request,user)
+ return redirect('home')
+ else:
+ message.error(request,'A error occured during registeration')
+ return render(request,'base/login_register.html',{'form' : form})
+
+
+
+def home(request):
+ q=request.GET.get('q') if request.GET.get('q') != None else ''
+ rooms = Room.objects.filter(
+ Q(topic__name__icontains=q) |
+ Q(name__icontains=q) |
+ Q(desc__icontains=q)
+ )
+ topics=Topic.objects.all()
+ room_count=rooms.count()
+ room_messages=Message.objects.filter(Q(room__topic__name__icontains=q))
+
+ context = {'rooms': rooms,'topics':topics, 'room_count':room_count,'room_messages':room_messages}
+ return render(request, 'base/home.html', context)
+
+
+def room(request, pk):
+ room = Room.objects.get(id=pk)
+ room_messages=room.message_set.all()
+ participants=room.participants.all()
+ if request.method == 'POST':
+ message =Message.objects.create(
+ user=request.user,
+ room=room,
+ body= request.POST.get('body')
+ )
+ room.participants.add(request.user)
+ return redirect('room',pk=room.id)
+
+
+ context = {'room': room, 'room_messages':room_messages, 'participants':participants}
+ return render(request, 'base/room.html', context)
+
+
+# def userProfile(request,pk):
+# user=User.objects.get(id=pk)
+# context={'user':user}
+# return render(request,'base/profile.html',context)
+
+
+@login_required(login_url='login')
+def createRoom(request):
+ form = RoomForm()
+ if request.method == 'POST':
+ form = RoomForm(request.POST)
+ if form.is_valid():
+ form.save()
+ return redirect('home')
+
+ context = {'form': form}
+ return render(request, 'base/room_form.html', context)
+
+@login_required(login_url='login')
+def updateRoom(request, pk):
+ room = Room.objects.get(id=pk)
+ form = RoomForm(instance=room)
+
+ if request.user != room.host:
+ return HttpResponse('you are not allowed here!')
+
+ if request.method == 'POST':
+ form = RoomForm(request.POST, instance=room)
+ if form.is_valid():
+ form.save()
+ return redirect('home')
+ context = {'form': form}
+ return render(request, 'base/room_form.html', context)
+
+@login_required(login_url='login')
+def deleteRoom(request,pk):
+ room = Room.objects.get(id=pk)
+
+ if request.user != room.host:
+ return HttpResponse('you are not allowed here!')
+
+ if request.method=='POST':
+ room.delete()
+ return redirect('home')
+ return render(request,'base/delete.html',{'obj':room})
+
+
+
+@login_required(login_url='login')
+def deleteMessage(request,pk):
+ message = Message.objects.get(id=pk)
+
+ if request.user != message.user:
+ return HttpResponse('you are not allowed here!')
+
+ if request.method=='POST':
+ message.delete()
+ return redirect('home')
+ return render(request,'base/delete.html',{'obj':message})
\ No newline at end of file
diff --git a/myclass/myproject/myproject/__init__.py b/myclass/myproject/myproject/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/myclass/myproject/myproject/__pycache__/__init__.cpython-310.pyc b/myclass/myproject/myproject/__pycache__/__init__.cpython-310.pyc
new file mode 100644
index 0000000..0a5953c
Binary files /dev/null and b/myclass/myproject/myproject/__pycache__/__init__.cpython-310.pyc differ
diff --git a/myclass/myproject/myproject/__pycache__/settings.cpython-310.pyc b/myclass/myproject/myproject/__pycache__/settings.cpython-310.pyc
new file mode 100644
index 0000000..cdc8575
Binary files /dev/null and b/myclass/myproject/myproject/__pycache__/settings.cpython-310.pyc differ
diff --git a/myclass/myproject/myproject/__pycache__/urls.cpython-310.pyc b/myclass/myproject/myproject/__pycache__/urls.cpython-310.pyc
new file mode 100644
index 0000000..d268056
Binary files /dev/null and b/myclass/myproject/myproject/__pycache__/urls.cpython-310.pyc differ
diff --git a/myclass/myproject/myproject/__pycache__/wsgi.cpython-310.pyc b/myclass/myproject/myproject/__pycache__/wsgi.cpython-310.pyc
new file mode 100644
index 0000000..fc20d02
Binary files /dev/null and b/myclass/myproject/myproject/__pycache__/wsgi.cpython-310.pyc differ
diff --git a/myclass/myproject/myproject/asgi.py b/myclass/myproject/myproject/asgi.py
new file mode 100644
index 0000000..8d061fd
--- /dev/null
+++ b/myclass/myproject/myproject/asgi.py
@@ -0,0 +1,16 @@
+"""
+ASGI config for myproject project.
+
+It exposes the ASGI callable as a module-level variable named ``application``.
+
+For more information on this file, see
+https://docs.djangoproject.com/en/4.0/howto/deployment/asgi/
+"""
+
+import os
+
+from django.core.asgi import get_asgi_application
+
+os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'myproject.settings')
+
+application = get_asgi_application()
diff --git a/myclass/myproject/myproject/settings.py b/myclass/myproject/myproject/settings.py
new file mode 100644
index 0000000..0d5f527
--- /dev/null
+++ b/myclass/myproject/myproject/settings.py
@@ -0,0 +1,127 @@
+"""
+Django settings for myproject project.
+
+Generated by 'django-admin startproject' using Django 4.0.6.
+
+For more information on this file, see
+https://docs.djangoproject.com/en/4.0/topics/settings/
+
+For the full list of settings and their values, see
+https://docs.djangoproject.com/en/4.0/ref/settings/
+"""
+
+from pathlib import Path
+import os
+# Build paths inside the project like this: BASE_DIR / 'subdir'.
+BASE_DIR = Path(__file__).resolve().parent.parent
+
+
+# Quick-start development settings - unsuitable for production
+# See https://docs.djangoproject.com/en/4.0/howto/deployment/checklist/
+
+# SECURITY WARNING: keep the secret key used in production secret!
+SECRET_KEY = 'django-insecure-tkk%z&(y!lt2=2op3b$2v&6b@kof_0x7cfz0hsodyw&3s+4u*b'
+
+# SECURITY WARNING: don't run with debug turned on in production!
+DEBUG = True
+
+ALLOWED_HOSTS = []
+
+
+# Application definition
+
+INSTALLED_APPS = [
+ 'django.contrib.admin',
+ 'django.contrib.auth',
+ 'django.contrib.contenttypes',
+ 'django.contrib.sessions',
+ 'django.contrib.messages',
+ 'django.contrib.staticfiles',
+ 'myapp.apps.MyappConfig',
+
+]
+
+MIDDLEWARE = [
+ 'django.middleware.security.SecurityMiddleware',
+ 'django.contrib.sessions.middleware.SessionMiddleware',
+ 'django.middleware.common.CommonMiddleware',
+ 'django.middleware.csrf.CsrfViewMiddleware',
+ 'django.contrib.auth.middleware.AuthenticationMiddleware',
+ 'django.contrib.messages.middleware.MessageMiddleware',
+ 'django.middleware.clickjacking.XFrameOptionsMiddleware',
+]
+
+ROOT_URLCONF = 'myproject.urls'
+
+TEMPLATES = [
+ {
+ 'BACKEND': 'django.template.backends.django.DjangoTemplates',
+ 'DIRS': ['templates'],
+ 'APP_DIRS': True,
+ 'OPTIONS': {
+ 'context_processors': [
+ 'django.template.context_processors.debug',
+ 'django.template.context_processors.request',
+ 'django.contrib.auth.context_processors.auth',
+ 'django.contrib.messages.context_processors.messages',
+ ],
+ },
+ },
+]
+
+WSGI_APPLICATION = 'myproject.wsgi.application'
+
+
+# Database
+# https://docs.djangoproject.com/en/4.0/ref/settings/#databases
+
+DATABASES = {
+ 'default': {
+ 'ENGINE': 'django.db.backends.sqlite3',
+ 'NAME': BASE_DIR / 'db.sqlite3',
+ }
+}
+
+
+# Password validation
+# https://docs.djangoproject.com/en/4.0/ref/settings/#auth-password-validators
+
+AUTH_PASSWORD_VALIDATORS = [
+ {
+ 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
+ },
+ {
+ 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
+ },
+ {
+ 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
+ },
+ {
+ 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
+ },
+]
+
+
+# Internationalization
+# https://docs.djangoproject.com/en/4.0/topics/i18n/
+
+LANGUAGE_CODE = 'en-us'
+
+TIME_ZONE = 'UTC'
+
+USE_I18N = True
+
+USE_TZ = True
+
+
+# Static files (CSS, JavaScript, Images)
+# https://docs.djangoproject.com/en/4.0/howto/static-files/
+
+STATIC_URL = 'static/'
+
+
+STATIC_ROOT=os.path.join(BASE_DIR,'static')
+# Default primary key field type
+# https://docs.djangoproject.com/en/4.0/ref/settings/#default-auto-field
+
+DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
diff --git a/myclass/myproject/myproject/urls.py b/myclass/myproject/myproject/urls.py
new file mode 100644
index 0000000..8076f92
--- /dev/null
+++ b/myclass/myproject/myproject/urls.py
@@ -0,0 +1,22 @@
+"""myproject URL Configuration
+
+The `urlpatterns` list routes URLs to views. For more information please see:
+ https://docs.djangoproject.com/en/4.0/topics/http/urls/
+Examples:
+Function views
+ 1. Add an import: from my_app import views
+ 2. Add a URL to urlpatterns: path('', views.home, name='home')
+Class-based views
+ 1. Add an import: from other_app.views import Home
+ 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
+Including another URLconf
+ 1. Import the include() function: from django.urls import include, path
+ 2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
+"""
+from django.contrib import admin
+from django.urls import path,include
+
+urlpatterns = [
+ path('admin/', admin.site.urls),
+ path('',include('myapp.urls'))
+]
diff --git a/myclass/myproject/myproject/wsgi.py b/myclass/myproject/myproject/wsgi.py
new file mode 100644
index 0000000..dd25891
--- /dev/null
+++ b/myclass/myproject/myproject/wsgi.py
@@ -0,0 +1,16 @@
+"""
+WSGI config for myproject project.
+
+It exposes the WSGI callable as a module-level variable named ``application``.
+
+For more information on this file, see
+https://docs.djangoproject.com/en/4.0/howto/deployment/wsgi/
+"""
+
+import os
+
+from django.core.wsgi import get_wsgi_application
+
+os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'myproject.settings')
+
+application = get_wsgi_application()
diff --git a/myclass/myproject/templates/main.html b/myclass/myproject/templates/main.html
new file mode 100644
index 0000000..ccd753e
--- /dev/null
+++ b/myclass/myproject/templates/main.html
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+ {% load static %}
+
+
+
+
+ classBudy
+
+
+
+
+
+{% include 'navbar.html' %}
+
+{% if messages %}
+
+ {% for message in messages %}
+ {{ message }}
+ {% endfor %}
+
+{% endif %}
+
+{% block contant %}
+
+{% endblock %}
+
+
+
\ No newline at end of file
diff --git a/myclass/myproject/templates/navbar.html b/myclass/myproject/templates/navbar.html
new file mode 100644
index 0000000..5899e12
--- /dev/null
+++ b/myclass/myproject/templates/navbar.html
@@ -0,0 +1,14 @@
+
+UniHelp
+
+
+
+{% if request.user.is_authenticated %}
+Hello {{request.user}}
+Logout
+{% else %}
+Login
+{% endif %}
+
\ No newline at end of file
diff --git a/myclass/static/styles/main.css b/myclass/static/styles/main.css
new file mode 100644
index 0000000..ec7395a
--- /dev/null
+++ b/myclass/static/styles/main.css
@@ -0,0 +1,3 @@
+body{
+ background-color:rgb(88, 147, 128) ;
+}
\ No newline at end of file
Conversation
++ + {% for message in room_messages %} +
{{message.body}}
++