Skip to content
Open
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Binary file added .DS_Store
Binary file not shown.
Binary file added investaware/.DS_Store
Binary file not shown.
44 changes: 44 additions & 0 deletions investaware/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Empowering-Investors-Hackathon

## Submission Instruction:
1. Fork this repository
2. Create a folder with your Team Name
3. Upload all the code and necessary files in the created folder
4. Upload a **README.md** file in your folder with the below mentioned informations.
5. Generate a Pull Request with your Team Name. (Example: submission-XYZ_team)

## README.md must consist of the following information:

#### Team Name - InvestAware
#### Problem Statement - Content Curation and Execution
#### Team Leader Email - [email protected]

## A Brief of the Prototype:
1: The video is inside: https://www.youtube.com/watch?v=ksngr6Zrwvg
2: The application is live: https://investaware.beyondirr.tech and with username [email protected] and password test@123
3: The admin is live on :https://api.investaware.beyondirr.tech/admin with same credentials as above.

## Tech Stack:
ReactJs
Django


## Step-by-Step Code Execution Instructions:
For API repo:
1: Checkout api repo and Create virtual environment venv downloading conda and using Python 3.9
2: Enter Virtual Environment source/venv/bin/activate
3: pip install -r requirements.txt
4: Add ALLOWED_HOSTS = ["127.0.0.1"] and CSRF_TRUSTED_ORIGINS = ["http://127.0.0.1"]
5: Run python manage.py runserver

For Frontend repo:
1: Install nvm
2: nvm use 16
3: npm install
4: npm start
5: search for {{api_url}} in code and change to "127.0.0.1:8000" as it points to api repo



## What I Learned:
During the prototype development of a Django and React-based investment content app, I learned to integrate frontend and backend seamlessly, manage user authentication, design interactive UI, fetch and display dynamic data, and optimize for responsiveness. Testing and debugging were crucial for a smooth user experience, enhancing my full-stack skills significantly.
8 changes: 8 additions & 0 deletions investaware/api/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM python:3.8

RUN python -m pip install --upgrade pip
ENV PYTHONUNBUFFERED=1
COPY requirements.txt requirements.txt
RUN python -m pip install -r requirements.txt

COPY . .
1 change: 1 addition & 0 deletions investaware/api/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# investaware
Empty file.
5 changes: 5 additions & 0 deletions investaware/api/accounts/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from django.contrib import admin

# Register your models here.
from .models import Accounts
admin.site.register(Accounts)
6 changes: 6 additions & 0 deletions investaware/api/accounts/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.apps import AppConfig


class UsersConfig(AppConfig):
default_auto_field = "django.db.models.BigAutoField"
name = "accounts"
24 changes: 24 additions & 0 deletions investaware/api/accounts/backend.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
from django.contrib.auth import get_user_model
from django.contrib.auth.backends import ModelBackend
from django.db.models import Q

UserModel = get_user_model()


class CustomAuthBackend(ModelBackend):
def authenticate(self, request, username=None, password=None, **kwargs):
if username is None:
username = kwargs.get(
UserModel.USERNAME_FIELD, kwargs.get(UserModel.EMAIL_FIELD)
)
if username is None or password is None:
return
try:
user = UserModel.objects.get(Q(email__iexact=username))

except UserModel.DoesNotExist:
UserModel().set_password(password)

else:
if user.check_password(password) and self.user_can_authenticate(user):
return user
168 changes: 168 additions & 0 deletions investaware/api/accounts/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
# Generated by Django 4.2.4 on 2023-08-23 12:47

import accounts.models.user_models
from django.conf import settings
import django.contrib.auth.models
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import uuid


class Migration(migrations.Migration):

initial = True

dependencies = [
("auth", "0012_alter_user_first_name_max_length"),
]

operations = [
migrations.CreateModel(
name="Accounts",
fields=[
("password", models.CharField(max_length=128, verbose_name="password")),
(
"last_login",
models.DateTimeField(
blank=True, null=True, verbose_name="last login"
),
),
(
"is_superuser",
models.BooleanField(
default=False,
help_text="Designates that this user has all permissions without explicitly assigning them.",
verbose_name="superuser status",
),
),
(
"is_staff",
models.BooleanField(
default=False,
help_text="Designates whether the user can log into this admin site.",
verbose_name="staff status",
),
),
(
"is_active",
models.BooleanField(
default=True,
help_text="Designates whether this user should be treated as active. Unselect this instead of deleting accounts.",
verbose_name="active",
),
),
(
"date_joined",
models.DateTimeField(
default=django.utils.timezone.now, verbose_name="date joined"
),
),
(
"id",
models.UUIDField(
default=uuid.uuid4,
editable=False,
primary_key=True,
serialize=False,
),
),
("username", models.CharField(max_length=50, verbose_name="Full Name")),
(
"email",
models.EmailField(
max_length=254, unique=True, verbose_name="Email Address"
),
),
("contact", models.CharField(max_length=20)),
("dob", models.DateField(default="1999-01-01")),
(
"profile_pic",
models.ImageField(
blank=True,
null=True,
upload_to=accounts.models.user_models.profile_pic_upload,
),
),
(
"role",
models.CharField(
choices=[
("-", "--"),
("U", "User"),
("M", "Moderator"),
("A", "Author"),
],
default="-",
max_length=5,
),
),
("can_read_blogs", models.BooleanField(default=False)),
("can_write_blogs", models.BooleanField(default=False)),
("can_ask_question", models.BooleanField(default=False)),
("can_answer_question", models.BooleanField(default=False)),
("can_comment", models.BooleanField(default=False)),
("can_chatgpt", models.BooleanField(default=False)),
("can_solve_quiz", models.BooleanField(default=False)),
("can_rate_blogs", models.BooleanField(default=False)),
(
"groups",
models.ManyToManyField(
blank=True,
help_text="The groups this user belongs to. A user will get all permissions granted to each of their groups.",
related_name="user_set",
related_query_name="user",
to="auth.group",
verbose_name="groups",
),
),
(
"user_permissions",
models.ManyToManyField(
blank=True,
help_text="Specific permissions for this user.",
related_name="user_set",
related_query_name="user",
to="auth.permission",
verbose_name="user permissions",
),
),
],
options={
"verbose_name": "user",
"verbose_name_plural": "users",
"abstract": False,
},
managers=[
("objects", django.contrib.auth.models.UserManager()),
],
),
migrations.CreateModel(
name="TokenLog",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("token", models.CharField(max_length=255)),
("is_blacklisted", models.BooleanField(default=False)),
("created_at", models.DateTimeField()),
("expire_at", models.DateTimeField()),
(
"user",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
to=settings.AUTH_USER_MODEL,
),
),
],
options={
"ordering": ["-created_at"],
},
),
]
Empty file.
1 change: 1 addition & 0 deletions investaware/api/accounts/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .user_models import Accounts
Loading