Skip to content

Commit c041991

Browse files
authored
Merge pull request larymak#255 from RitiKSIBJr/new-django
django projects
2 parents f542650 + 0ec4bc7 commit c041991

38 files changed

+769
-0
lines changed

DJANGO PROJECTS/Chat/README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Django Chat Application
2+
3+
## Overview
4+
5+
This is a simple django chat applications for real time chatting. One needs to create an account to be able to chat with others. User can create their own room for chatting.
6+
7+
## Libraries and Frameworks:
8+
9+
These are the libraries and frameworks used to build this chat application.
10+
1.Django == 3.0.2
11+
2.django-environ == 4.1.4
12+
3.channels == 3.0.4
13+
14+
[![Screenshot-70.png](https://i.postimg.cc/jqWhGBq1/Screenshot-70.png)](https://postimg.cc/fkNXd297)
15+
16+
17+
## Getting started with project
18+
First clone the repository from Github and cd into the Djagno Projects/Chat
19+
20+
Activate the virtualenv for the project
21+
22+
Install project dependencies
23+
```bash
24+
$ pip install -r requirements.txt
25+
```
26+
27+
Then aplly the migrations
28+
```bash
29+
$ python manage.py runserver
30+
```
31+
32+
Now you can run the server
33+
```bash
34+
$ python manage.py runserver
35+
```

DJANGO PROJECTS/Chat/chat/__init__.py

Whitespace-only changes.

DJANGO PROJECTS/Chat/chat/admin.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from django.contrib import admin
2+
3+
# Register your models here.

DJANGO PROJECTS/Chat/chat/apps.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
from django.apps import AppConfig
2+
3+
4+
class ChatConfig(AppConfig):
5+
default_auto_field = 'django.db.models.BigAutoField'
6+
name = 'chat'

DJANGO PROJECTS/Chat/chat/forms.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
from django import forms
2+
from django.contrib.auth.forms import UserCreationForm
3+
from django.contrib.auth.models import User
4+
5+
class NewUserForm(UserCreationForm):
6+
email = forms.EmailField(required=True)
7+
8+
class Meta:
9+
model = User
10+
fields = ('username', 'email', 'password1', 'password2')
11+
12+
def save(self, commit=True):
13+
user = super(NewUserForm,self).save(commit=False)
14+
user.email = self.cleaned_data['email']
15+
if commit:
16+
user.save()
17+
return user
18+
19+
def __init__(self, *args, **kwargs):
20+
super(UserCreationForm, self).__init__(*args, **kwargs)
21+
self.fields['username'].help_text = None
22+
self.fields['password2'].help_text = None
23+
self.fields['password1'].help_text = None

DJANGO PROJECTS/Chat/chat/migrations/__init__.py

Whitespace-only changes.

DJANGO PROJECTS/Chat/chat/models.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from django.db import models
2+
3+
# Create your models here.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{% extends 'base.html' %}
2+
{% block title %}Home{% endblock %}
3+
4+
{% block content %}
5+
6+
<div class="container">
7+
{% if user.is_authenticated %}
8+
<div class="container fixed-card card">
9+
<h1>User is authenticated</h1>
10+
<p>This is a <strong>chat system app</strong> build in <strong>Python-Django</strong>.<br>
11+
12+
<ul style="text-align: left;">
13+
Featues:
14+
<li>Sign up to chat.</li>
15+
<li>Log in and log out from the app.</li>
16+
<li>Send messages and read messages.</li>
17+
<li>Create new rooms.</li>
18+
</ul></p>
19+
</div>
20+
{% else %}
21+
<div class="container fixed-card card">
22+
<h1>User is not authenticated</h1>
23+
<p>Make sure or <strong>logged in</strong> else you can <strong>sign up</strong>.</p>
24+
<a href="{% url 'login' %}" style="text-decoration: underline;">Follow this link to login or check the top right corner.</a>
25+
<a href="{% url 'register' %}" style="text-decoration: underline;">Follow this link to sign up or check the top right corner.</a>
26+
</div>
27+
{% endif %}
28+
</div>
29+
30+
{% endblock %}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{% extends 'base.html' %}
2+
{% block title %}LogIn{% endblock %}
3+
4+
{% block content %}
5+
6+
<div class="container card">
7+
<h1 class="head">Log In</h1>
8+
9+
<form method="post">
10+
{% csrf_token %}
11+
{{ form.as_p }}
12+
<input type="submit" value="LogIn" class="btn btn-dark in">
13+
</form>
14+
</div>
15+
16+
{% endblock %}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{% extends 'base.html' %}
2+
3+
{% block title %}Sign In{% endblock %}
4+
5+
{% block content %}
6+
<div class="container card register-card">
7+
<h1>Register</h1>
8+
<form method="post">
9+
{% csrf_token %}
10+
{{ form.as_p }}
11+
<input type="submit" value="Sign In" class="btn btn-dark in">
12+
</form>
13+
</div>
14+
{% endblock %}

0 commit comments

Comments
 (0)