diff --git a/.gitignore b/.gitignore index d3cebda..941deef 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ .env settings.py __pycache__/ -db.sqlite3 \ No newline at end of file +db.sqlite3 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..18556b8 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,19 @@ +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v2.3.0 + hooks: + - id: check-yaml + - id: end-of-file-fixer + - id: trailing-whitespace + - repo: https://github.com/psf/black + rev: 22.10.0 + hooks: + - id: black + #- repo: https://github.com/thibaudcolas/curlylint + # rev: v0.13.1 + # hooks: + # - id: curlylint + - repo: https://github.com/pre-commit/mirrors-prettier + rev: v3.0.2 + hooks: + - id: prettier diff --git a/README.md b/README.md index cb93f00..641a213 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,3 @@ # code-spark + Code Spark: A dating-style app for programmers to find project partners. And love? diff --git a/TODO.md b/TODO.md new file mode 100644 index 0000000..bdaec3e --- /dev/null +++ b/TODO.md @@ -0,0 +1,12 @@ +# Todo + +- [x] login feature +- [x] see another profile, selected randomly + - [x] design necessary data + - [x] mvp of seeing another user from the database + - [x] randomize it +- [ ] Let a user to request a match or decline + - [x] Send a form response to /match + - [x] Receive the form and create a MatchRequest object + - [x] Handle the case on the home page when there are no matches available + - [ ] Handle the case when user requests a match and a match reqeust object exists with current user as the target diff --git a/code_spark/app/apps.py b/code_spark/app/apps.py index ed327d2..bcfe39b 100644 --- a/code_spark/app/apps.py +++ b/code_spark/app/apps.py @@ -2,5 +2,5 @@ class AppConfig(AppConfig): - default_auto_field = 'django.db.models.BigAutoField' - name = 'app' + default_auto_field = "django.db.models.BigAutoField" + name = "app" diff --git a/code_spark/app/migrations/0001_initial.py b/code_spark/app/migrations/0001_initial.py index 46f0c1c..ba14608 100644 --- a/code_spark/app/migrations/0001_initial.py +++ b/code_spark/app/migrations/0001_initial.py @@ -8,26 +8,55 @@ class Migration(migrations.Migration): initial = True - dependencies = [ - ] + dependencies = [] operations = [ migrations.CreateModel( - name='UserAccount', + name="UserAccount", fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('github_profile_name', models.CharField(max_length=255, unique=True)), + ( + "id", + models.BigAutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("github_profile_name", models.CharField(max_length=255, unique=True)), ], ), migrations.CreateModel( - name='MatchRequest', + name="MatchRequest", fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('match_request_status', models.IntegerField()), - ('created_date', models.DateTimeField(auto_now_add=True)), - ('accepted_date', models.DateTimeField(blank=True, null=True)), - ('match_request_receiver', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='received_requests', to='app.useraccount')), - ('match_request_sender', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='sent_requests', to='app.useraccount')), + ( + "id", + models.BigAutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("match_request_status", models.IntegerField()), + ("created_date", models.DateTimeField(auto_now_add=True)), + ("accepted_date", models.DateTimeField(blank=True, null=True)), + ( + "match_request_receiver", + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + related_name="received_requests", + to="app.useraccount", + ), + ), + ( + "match_request_sender", + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + related_name="sent_requests", + to="app.useraccount", + ), + ), ], ), ] diff --git a/code_spark/app/migrations/0002_alter_matchrequest_match_request_receiver_and_more.py b/code_spark/app/migrations/0002_alter_matchrequest_match_request_receiver_and_more.py new file mode 100644 index 0000000..9776814 --- /dev/null +++ b/code_spark/app/migrations/0002_alter_matchrequest_match_request_receiver_and_more.py @@ -0,0 +1,37 @@ +# Generated by Django 4.2.4 on 2023-08-17 15:45 + +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), + ("app", "0001_initial"), + ] + + operations = [ + migrations.AlterField( + model_name="matchrequest", + name="match_request_receiver", + field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + related_name="received_requests", + to=settings.AUTH_USER_MODEL, + ), + ), + migrations.AlterField( + model_name="matchrequest", + name="match_request_sender", + field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + related_name="sent_requests", + to=settings.AUTH_USER_MODEL, + ), + ), + migrations.DeleteModel( + name="UserAccount", + ), + ] diff --git a/code_spark/app/models.py b/code_spark/app/models.py index 86f1c27..a4b73cb 100644 --- a/code_spark/app/models.py +++ b/code_spark/app/models.py @@ -3,9 +3,15 @@ class MatchRequest(models.Model): - match_request_sender = models.ForeignKey(User, related_name='sent_requests', on_delete=models.CASCADE) - match_request_receiver = models.ForeignKey(User, related_name='received_requests', on_delete=models.CASCADE) - match_request_status = models.IntegerField() + match_request_sender = models.ForeignKey( + User, related_name="sent_requests", on_delete=models.CASCADE + ) + match_request_receiver = models.ForeignKey( + User, related_name="received_requests", on_delete=models.CASCADE + ) + match_request_status = ( + models.IntegerField() + ) # 1 is request_match sent, -1 is sender declined, 2 is receiver accepted, -2 is receiver declined. created_date = models.DateTimeField(auto_now_add=True) accepted_date = models.DateTimeField(null=True, blank=True) diff --git a/code_spark/app/templates/base.html b/code_spark/app/templates/base.html index 9c4361b..268d3c7 100644 --- a/code_spark/app/templates/base.html +++ b/code_spark/app/templates/base.html @@ -1,26 +1,25 @@ {% load static %} - + -
- - - - - -