added ratings too universityreview model
This commit is contained in:
parent
afa45122b7
commit
f059e317b6
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -8,6 +8,7 @@ class UniversityReviewSerializer(serializers.ModelSerializer):
|
|||
fields = [
|
||||
'pk',
|
||||
'university_name',
|
||||
'rating',
|
||||
'title',
|
||||
'username',
|
||||
'date_published',
|
||||
|
@ -15,5 +16,4 @@ class UniversityReviewSerializer(serializers.ModelSerializer):
|
|||
]
|
||||
read_only_fields =[
|
||||
'pk',
|
||||
'username'
|
||||
]
|
|
@ -0,0 +1,86 @@
|
|||
# Generated by Django 2.0.6 on 2018-09-26 11:12
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('postings', '0003_universityreview_title'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='RateableEntity',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('name', models.CharField(max_length=256)),
|
||||
],
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='Review',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('rating', models.IntegerField(default=1)),
|
||||
('title', models.CharField(max_length=128)),
|
||||
('content', models.TextField()),
|
||||
('created_date', models.DateTimeField(auto_now_add=True)),
|
||||
('last_updated_date', models.DateTimeField(auto_now=True)),
|
||||
],
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='ReviewHelpfulVote',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('helpful', models.BooleanField()),
|
||||
('review', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='postings.Review')),
|
||||
],
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='universityreview',
|
||||
name='rating',
|
||||
field=models.IntegerField(default=1),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='Course',
|
||||
fields=[
|
||||
('rateableentity_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='postings.RateableEntity')),
|
||||
],
|
||||
bases=('postings.rateableentity',),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='Professor',
|
||||
fields=[
|
||||
('rateableentity_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='postings.RateableEntity')),
|
||||
],
|
||||
bases=('postings.rateableentity',),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='University',
|
||||
fields=[
|
||||
('rateableentity_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='postings.RateableEntity')),
|
||||
],
|
||||
bases=('postings.rateableentity',),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='review',
|
||||
name='rateable_entity',
|
||||
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='postings.RateableEntity'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='professor',
|
||||
name='university',
|
||||
field=models.ManyToManyField(to='postings.University'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='course',
|
||||
name='professors',
|
||||
field=models.ManyToManyField(to='postings.Professor'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='course',
|
||||
name='taught_at_university',
|
||||
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='postings.University'),
|
||||
),
|
||||
]
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -48,6 +48,7 @@ class Course(RateableEntity):
|
|||
class UniversityReview(models.Model):
|
||||
university_name = models.CharField(max_length=200)
|
||||
username = models.CharField(max_length=200)
|
||||
rating = models.IntegerField(default=1)
|
||||
title = models.CharField(max_length=200)
|
||||
date_published = models.DateTimeField('date published')
|
||||
content = models.CharField(max_length=200)
|
||||
|
|
Loading…
Reference in New Issue