Skip to content

Commit

Permalink
Merge pull request #355 from bughunter9/Mods
Browse files Browse the repository at this point in the history
Resource Model Updated
  • Loading branch information
jsparmani authored Oct 20, 2020
2 parents 4628b6e + 3ebee9e commit 8bc5df8
Show file tree
Hide file tree
Showing 6 changed files with 138 additions and 9 deletions.
43 changes: 43 additions & 0 deletions officialWebsite/resources/migrations/0003_auto_20201020_1805.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Generated by Django 3.1.1 on 2020-10-20 18:05

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
("resources", "0002_auto_20201007_2250"),
]

operations = [
migrations.RenameField(
model_name="resource",
old_name="title",
new_name="topic",
),
migrations.RenameField(
model_name="resource",
old_name="docs",
new_name="url",
),
migrations.RemoveField(
model_name="resource",
name="description",
),
migrations.RemoveField(
model_name="resource",
name="headline_event",
),
migrations.RemoveField(
model_name="resource",
name="image",
),
migrations.RemoveField(
model_name="resource",
name="info",
),
migrations.RemoveField(
model_name="resource",
name="link",
),
]
41 changes: 41 additions & 0 deletions officialWebsite/resources/migrations/0004_auto_20201020_1902.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Generated by Django 3.1.1 on 2020-10-20 19:02

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


class Migration(migrations.Migration):

dependencies = [
("resources", "0003_auto_20201020_1805"),
]

operations = [
migrations.CreateModel(
name="Topic",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("topic", models.CharField(default="Human", max_length=255)),
],
),
migrations.AlterField(
model_name="resource",
name="url",
field=models.URLField(default="Human", max_length=255),
),
migrations.AlterField(
model_name="resource",
name="topic",
field=models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE, to="resources.topic"
),
),
]
26 changes: 26 additions & 0 deletions officialWebsite/resources/migrations/0005_auto_20201020_1949.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Generated by Django 3.1.1 on 2020-10-20 19:49

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("events", "0007_auto_20200515_1214"),
("resources", "0004_auto_20201020_1902"),
]

operations = [
migrations.RemoveField(
model_name="resource",
name="topic",
),
migrations.AddField(
model_name="resource",
name="topic",
field=models.ManyToManyField(blank=True, to="events.Topic"),
),
migrations.DeleteModel(
name="Topic",
),
]
23 changes: 23 additions & 0 deletions officialWebsite/resources/migrations/0006_auto_20201020_1954.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 3.1.1 on 2020-10-20 19:54

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("resources", "0005_auto_20201020_1949"),
]

operations = [
migrations.AlterField(
model_name="resource",
name="name",
field=models.CharField(default="", max_length=255),
),
migrations.AlterField(
model_name="resource",
name="url",
field=models.URLField(default=""),
),
]
12 changes: 4 additions & 8 deletions officialWebsite/resources/models.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
from django.db import models
from officialWebsite.events.models import Topic


class Resource(models.Model):
name = models.CharField(max_length=255, blank=False, default="Human")
title = models.CharField(max_length=255, default="Human")
info = models.TextField(max_length=255, default="Human")
description = models.TextField(max_length=255, default="Human")
link = models.URLField(blank=True)
docs = models.URLField(blank=True)
headline_event = models.BooleanField(default=False)
image = models.ImageField(upload_to="resource-images/", blank=True)
name = models.CharField(max_length=255, blank=False, default="")
url = models.URLField(blank=False, default="")
topic = models.ManyToManyField(Topic, blank=True)

def __str__(self):
return self.name
2 changes: 1 addition & 1 deletion officialWebsite/resources/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ class ResourceSerializer(serializers.ModelSerializer):

class Meta:
model = models.Resource
fields = ("id", "name", "link")
fields = ("id", "name", "url", "topic")
read_only_fields = ("id",)

0 comments on commit 8bc5df8

Please sign in to comment.