Skip to content

Commit 17d334b

Browse files
committed
Merge branch 'elif_addition' into dev
2 parents 765e7e5 + ba88f7a commit 17d334b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+6359
-2997
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ jobs:
2828
- name: Run tests
2929
run: |
3030
source venv/bin/activate
31-
python backend/manage.py test
31+
python backend/manage.py test

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"editor.formatOnSave": false
3+
}

.gitignore renamed to backend/.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,4 +409,3 @@ cython_debug/
409409
.cursorignore
410410
.cursorindexingignore
411411

412-
venv/

backend/backend/settings.py

Lines changed: 39 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,17 @@
4040

4141
'corsheaders',
4242
'rest_framework',
43-
'rest_framework.authtoken', # Add this for token authentication
43+
'rest_framework.authtoken',
4444
'giraph',
4545
'users',
4646
'programs',
4747
'outcomes',
4848
]
4949

5050
MIDDLEWARE = [
51+
'corsheaders.middleware.CorsMiddleware', # Must be first
5152
'django.middleware.security.SecurityMiddleware',
5253
'django.contrib.sessions.middleware.SessionMiddleware',
53-
'corsheaders.middleware.CorsMiddleware',
5454
'django.middleware.common.CommonMiddleware',
5555
'django.middleware.csrf.CsrfViewMiddleware',
5656
'django.contrib.auth.middleware.AuthenticationMiddleware',
@@ -60,8 +60,36 @@
6060

6161
ROOT_URLCONF = 'backend.urls'
6262

63+
REST_FRAMEWORK = {
64+
'DEFAULT_AUTHENTICATION_CLASSES': [
65+
'rest_framework.authentication.TokenAuthentication',
66+
'rest_framework.authentication.SessionAuthentication',
67+
],
68+
'DEFAULT_PERMISSION_CLASSES': [
69+
'rest_framework.permissions.IsAuthenticated',
70+
],
71+
}
72+
73+
# CORS settings
6374
CORS_ALLOWED_ORIGINS = [
6475
"http://localhost:3000",
76+
"http://127.0.0.1:3000",
77+
"http://localhost:3001",
78+
"http://127.0.0.1:3001",
79+
]
80+
81+
CORS_ALLOW_CREDENTIALS = True
82+
83+
CORS_ALLOW_HEADERS = [
84+
'accept',
85+
'accept-encoding',
86+
'authorization',
87+
'content-type',
88+
'dnt',
89+
'origin',
90+
'user-agent',
91+
'x-csrftoken',
92+
'x-requested-with',
6593
]
6694

6795
# Add custom user model
@@ -72,17 +100,6 @@
72100
'django.contrib.auth.backends.ModelBackend',
73101
]
74102

75-
# Add REST Framework configuration
76-
REST_FRAMEWORK = {
77-
'DEFAULT_AUTHENTICATION_CLASSES': [
78-
'rest_framework.authentication.TokenAuthentication',
79-
'rest_framework.authentication.SessionAuthentication',
80-
],
81-
'DEFAULT_PERMISSION_CLASSES': [
82-
'rest_framework.permissions.AllowAny', # Change to IsAuthenticated later
83-
],
84-
}
85-
86103
TEMPLATES = [
87104
{
88105
'BACKEND': 'django.template.backends.django.DjangoTemplates',
@@ -153,3 +170,12 @@
153170
# https://docs.djangoproject.com/en/5.2/ref/settings/#default-auto-field
154171

155172
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
173+
174+
# Email Configuration for Gmail
175+
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
176+
EMAIL_HOST = 'smtp.gmail.com'
177+
EMAIL_PORT = 587
178+
EMAIL_USE_TLS = True
179+
EMAIL_HOST_USER = '[email protected]'
180+
###EMAIL_HOST_PASSWORD =
181+
DEFAULT_FROM_EMAIL = '[email protected]'

backend/backend/urls.py

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,33 @@
1+
"""
2+
URL configuration for backend project.
3+
4+
The `urlpatterns` list routes URLs to views. For more information please see:
5+
https://docs.djangoproject.com/en/5.2/topics/http/urls/
6+
Examples:
7+
Function views
8+
1. Add an import: from my_app import views
9+
2. Add a URL to urlpatterns: path('', views.home, name='home')
10+
Class-based views
11+
1. Add an import: from other_app.views import Home
12+
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
13+
Including another URLconf
14+
1. Import the include() function: from django.urls import include, path
15+
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
16+
"""
117
from django.contrib import admin
218
from django.urls import path, include
319

420
urlpatterns = [
521
path('admin/', admin.site.urls),
22+
path('outcomes/', include('outcomes.urls')),
23+
24+
# API route namespaces
25+
path('api/auth/', include('users.urls')),
26+
path('api/users/', include('users.urls')),
27+
28+
# Programs and Giraph endpoints expected by the frontend
29+
path('api/programs/', include('programs.urls')),
630
path('api/giraph/', include('giraph.urls')),
7-
path('api/users/', include("users.urls")),
8-
path('api/outcomes/', include("outcomes.urls")),
9-
path('api/programs/', include("programs.urls")),
10-
]
31+
# Expose outcomes upload API under /api/outcomes/
32+
path('api/outcomes/', include('outcomes.urls')),
33+
]
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Generated by assistant on 2026-01-07
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
('giraph', '0003_node_course'),
10+
]
11+
12+
operations = [
13+
migrations.AddField(
14+
model_name='node',
15+
name='score',
16+
field=models.FloatField(blank=True, null=True),
17+
),
18+
]
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Generated by Django 5.2.8 on 2026-01-08 07:24
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
('giraph', '0004_add_score_to_node'),
10+
]
11+
12+
operations = [
13+
migrations.AddField(
14+
model_name='node',
15+
name='description',
16+
field=models.TextField(blank=True, null=True),
17+
),
18+
]
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Generated by Django 5.2.8 on 2026-01-08 07:32
2+
3+
from django.db import migrations
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
('giraph', '0005_node_description'),
10+
]
11+
12+
operations = [
13+
migrations.RemoveField(
14+
model_name='node',
15+
name='description',
16+
),
17+
]

backend/giraph/models.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@ class Node(models.Model):
1414
course = models.ForeignKey(
1515
Program, on_delete=models.CASCADE, related_name="nodes", null=True, blank=True
1616
)
17+
# Optional numeric score assigned from CSV imports or other sources
18+
score = models.FloatField(null=True, blank=True)
1719

1820
def __str__(self):
19-
return f"{self.id} | {self.layer} | {self.name}"
21+
return f"{self.id} | {self.layer} | {self.name}"
2022

2123

2224
class Relation(models.Model):

0 commit comments

Comments
 (0)