Skip to content
2 changes: 1 addition & 1 deletion FusionIIIT/Fusion/settings/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,8 @@
os.path.join(BASE_DIR, "static"),
)

MEDIA_ROOT = os.path.join(BASE_DIR, '..', 'media')
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')

ACCOUNT_USERNAME_REQUIRED = False
ACCOUNT_EMAIL_REQUIRED = True
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 3.1.5 on 2023-03-12 09:52

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('globals', '0001_initial'),
]

operations = [
migrations.AlterField(
model_name='extrainfo',
name='user_status',
field=models.CharField(choices=[('NEW', 'NEW'), ('PRESENT', 'PRESENT')], default='PRESENT', max_length=50),
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 3.1.5 on 2023-03-13 17:25

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('globals', '0002_auto_20230312_0952'),
]

operations = [
migrations.AlterField(
model_name='extrainfo',
name='user_status',
field=models.CharField(choices=[('PRESENT', 'PRESENT'), ('NEW', 'NEW')], default='PRESENT', max_length=50),
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 3.1.5 on 2023-03-13 17:33

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('globals', '0003_auto_20230313_1725'),
]

operations = [
migrations.AlterField(
model_name='extrainfo',
name='user_status',
field=models.CharField(choices=[('NEW', 'NEW'), ('PRESENT', 'PRESENT')], default='PRESENT', max_length=50),
),
]
5 changes: 3 additions & 2 deletions FusionIIIT/applications/online_cms/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@

from .models import (Assignment, CourseDocuments, CourseVideo, Forum,
ForumReply, Quiz, QuizQuestion, QuizResult, StudentAnswer,
StudentAssignment, Topics,CourseSlide)
StudentAssignment1, Topics,CourseAssignment,CourseSlide)

class QuizResultAdmin(admin.ModelAdmin):
model = QuizResult
raw_id_fields = ("student_id",)

admin.site.register(CourseDocuments)
admin.site.register(CourseAssignment)
admin.site.register(CourseSlide)
admin.site.register(CourseVideo)

Expand All @@ -22,7 +23,7 @@ class QuizResultAdmin(admin.ModelAdmin):

admin.site.register(Assignment)

admin.site.register(StudentAssignment)
admin.site.register(StudentAssignment1)

admin.site.register(QuizResult, QuizResultAdmin)

Expand Down
7 changes: 6 additions & 1 deletion FusionIIIT/applications/online_cms/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,4 +124,9 @@ class Meta:
fields=['couse_id','doc']

# title = forms.CharField(max_length=50)
file = forms.FileField()
file = forms.FileField()


class AssignmentMarks(forms.Form):
marks=forms.IntegerField()
feedback=forms.CharField(max_length=255)
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Generated by Django 3.1.5 on 2023-03-12 09:52

import applications.online_cms.models
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
('academic_information', '0001_initial'),
('online_cms', '0001_initial'),
]

operations = [
migrations.CreateModel(
name='CourseSlide',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('upload_time', models.DateTimeField(auto_now=True)),
('document_name', models.CharField(max_length=40)),
('description', models.CharField(max_length=100)),
('doc', models.FileField(blank=True, null=True, upload_to=applications.online_cms.models.content_file_name)),
('course_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='academic_information.course')),
],
),
migrations.CreateModel(
name='CourseAssignment',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('upload_time', models.DateTimeField(auto_now=True)),
('submit_date', models.DateTimeField()),
('assignment_name', models.CharField(max_length=100)),
('doc', models.FileField(blank=True, null=True, upload_to=applications.online_cms.models.assignment_file_name)),
('course_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='academic_information.course')),
],
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Generated by Django 3.1.5 on 2023-03-13 16:35

import applications.online_cms.models
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
('online_cms', '0002_courseassignment_courseslide'),
]

operations = [
migrations.RemoveField(
model_name='studentassignment',
name='upload_url',
),
migrations.AddField(
model_name='studentassignment',
name='doc',
field=models.FileField(blank=True, null=True, upload_to=applications.online_cms.models.assignment_submit_name),
),
migrations.AlterField(
model_name='studentassignment',
name='assignment_id',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='online_cms.courseassignment'),
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Generated by Django 3.1.5 on 2023-03-13 16:39

import applications.online_cms.models
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
('academic_information', '0001_initial'),
('online_cms', '0003_auto_20230313_1635'),
]

operations = [
migrations.CreateModel(
name='StudentAssignment1',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('upload_time', models.DateTimeField(auto_now=True)),
('doc', models.FileField(blank=True, null=True, upload_to=applications.online_cms.models.assignment_submit_name)),
('score', models.IntegerField(null=True)),
('feedback', models.CharField(max_length=100, null=True)),
('assign_name', models.CharField(max_length=100)),
('assignment_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='online_cms.courseassignment')),
('student_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='academic_information.student')),
],
),
migrations.DeleteModel(
name='StudentAssignment',
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Generated by Django 3.1.5 on 2023-03-13 17:33

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('online_cms', '0004_auto_20230313_1639'),
]

operations = [
migrations.AddField(
model_name='studentassignment1',
name='course_code',
field=models.CharField(default='CS416e', max_length=100),
preserve_default=False,
),
]
36 changes: 31 additions & 5 deletions FusionIIIT/applications/online_cms/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def content_file_name(instance, filename):
file_path = 'online_cms/{course_id}/doc/{fileName}.{ext}'.format(
course_id=course_code, fileName=instance.document_name, ext=ext)
return file_path
#the documents in the course (slides , ppt) added by the faculty and can be downloaded by the students
# the documents in the course (slides , ppt) added by the faculty and can be downloaded by the students
class CourseSlide(models.Model):
course_id = models.ForeignKey(Course, on_delete=models.CASCADE)
upload_time = models.DateTimeField(auto_now=True)
Expand All @@ -29,7 +29,7 @@ class CourseDocuments(models.Model):
upload_time = models.DateTimeField(auto_now=True)
description = models.CharField(max_length=100)
document_name = models.CharField(max_length=40)
document_url = models.CharField(max_length=500, null=True,blank=True)
document_url = models.CharField(max_length=100, null=True,blank=True)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use URLField instead of charfield for document_url . For charfields use max_length=255

# media = models.FileField(upload_to=content_file_name, null=True, blank=True)

def __str__(self):
Expand Down Expand Up @@ -187,11 +187,37 @@ def __str__(self):
return '{} - {} - {}'.format(self.pk, self.course_id, self.assignment_name)

#details of the solution uploaded by the student
class StudentAssignment(models.Model):
def assignment_submit_name(instance, filename):
name, ext = filename.split('.')
# obj=Curriculum.objects.get(course_id=instance.course_id)
course_code=instance.course_code
assignmentName=instance.assignment_id.assignment_name
file_path = 'online_cms/{course_id}/assi/{assignmentName}/{fileName}.{ext}'.format(
course_id=course_code,assignmentName=assignmentName, fileName=name, ext=ext)
return file_path
# class StudentAssignment(models.Model):
# student_id = models.ForeignKey(Student, on_delete=models.CASCADE)
# assignment_id = models.ForeignKey(CourseAssignment, on_delete=models.CASCADE)
# upload_time = models.DateTimeField(auto_now=True)
# # upload_url = models.TextField(max_length=200)
# doc = models.FileField(upload_to=assignment_submit_name, null=True, blank=True)
# score = models.IntegerField(null=True) #score is submitted by faculty
# feedback = models.CharField(max_length=100, null=True) #feedback by the faculty for the solution of the assignment submitted
# assign_name = models.CharField(max_length=100)

# def __str__(self):
# return '{} - {} - {} - {} - {}'.format(
# self.pk, self.student_id,
# self.assignment_id, self.score,
# self.feedback)
Comment on lines +198 to +212
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kindly remove the comment which is not needed.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will remove it after i am sure that any other module isn't using it


class StudentAssignment1(models.Model):
student_id = models.ForeignKey(Student, on_delete=models.CASCADE)
assignment_id = models.ForeignKey(Assignment, on_delete=models.CASCADE)
assignment_id = models.ForeignKey(CourseAssignment, on_delete=models.CASCADE)
upload_time = models.DateTimeField(auto_now=True)
upload_url = models.TextField(max_length=200)
# upload_url = models.TextField(max_length=200)
course_code=models.CharField(max_length=100)
doc = models.FileField(upload_to=assignment_submit_name, null=True, blank=True)
score = models.IntegerField(null=True) #score is submitted by faculty
feedback = models.CharField(max_length=100, null=True) #feedback by the faculty for the solution of the assignment submitted
assign_name = models.CharField(max_length=100)
Expand Down
4 changes: 3 additions & 1 deletion FusionIIIT/applications/online_cms/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@
url(r'^(?P<course_code>[A-z]+[0-9]+[A-z]?)/edit_bank/(?P<qb_code>[0-9]+)$',
views.edit_bank, name='edit_bank'),
url(r'^(?P<course_code>[A-z]+[0-9]+[A-z]?)/attendance$', views.submit_attendance,
name='submit_attendance'),]
name='submit_attendance'),
url(r'^(?P<course_code>[A-z]+[0-9]+[A-z]?)/edit-assignment-marks$', views.edit_assignment_marks,
name='assignment_marks'), ]

urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
Loading