-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
filter post with comment, added tags
- Loading branch information
Showing
20 changed files
with
265 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Generated by Django 4.0.8 on 2023-01-17 22:14 | ||
|
||
from django.conf import settings | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
('attendance', '0002_remove_attendance_title'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='attendance', | ||
name='attendees', | ||
field=models.ManyToManyField(to=settings.AUTH_USER_MODEL), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Generated by Django 4.0.8 on 2023-01-17 23:40 | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('event', '0002_alter_event_options'), | ||
('attendance', '0003_attendance_attendees'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='attendance', | ||
name='eventId', | ||
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='event_attendance', to='event.event'), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Generated by Django 4.0.8 on 2023-01-17 23:42 | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('event', '0002_alter_event_options'), | ||
('attendance', '0004_alter_attendance_eventid'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='attendance', | ||
name='eventId', | ||
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='event_attendance', to='event.event'), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Generated by Django 4.0.8 on 2023-01-18 12:12 | ||
|
||
from django.db import migrations | ||
import taggit.managers | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('taggit', '0005_auto_20220424_2025'), | ||
('blog', '0002_alter_post_slug'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='post', | ||
name='tags', | ||
field=taggit.managers.TaggableManager(help_text='A comma-separated list of tags.', through='taggit.TaggedItem', to='taggit.Tag', verbose_name='Tags'), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Generated by Django 4.0.8 on 2023-01-18 12:34 | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
import taggit.managers | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('contenttypes', '0002_remove_content_type_name'), | ||
('taggit', '0005_auto_20220424_2025'), | ||
('blog', '0003_post_tags'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='UUIDTaggedItem', | ||
fields=[ | ||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('object_id', models.UUIDField(db_index=True, verbose_name='object ID')), | ||
('content_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='%(app_label)s_%(class)s_tagged_items', to='contenttypes.contenttype', verbose_name='content type')), | ||
('tag', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='%(app_label)s_%(class)s_items', to='taggit.tag')), | ||
], | ||
options={ | ||
'verbose_name': 'Tag', | ||
'verbose_name_plural': 'Tags', | ||
}, | ||
), | ||
migrations.AlterField( | ||
model_name='post', | ||
name='tags', | ||
field=taggit.managers.TaggableManager(help_text='A comma-separated list of tags.', through='blog.UUIDTaggedItem', to='taggit.Tag', verbose_name='Tags'), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Generated by Django 4.0.8 on 2023-01-18 12:52 | ||
|
||
import blog.models | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('blog', '0004_uuidtaggeditem_alter_post_tags'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='post', | ||
name='id', | ||
field=models.UUIDField(default=blog.models.generateUUID, editable=False, primary_key=True, serialize=False), | ||
), | ||
] |
26 changes: 26 additions & 0 deletions
26
blog/migrations/0006_alter_comment_author_alter_comment_postid.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Generated by Django 4.0.8 on 2023-01-18 19:17 | ||
|
||
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), | ||
('blog', '0005_alter_post_id'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='comment', | ||
name='author', | ||
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='author_comments', to=settings.AUTH_USER_MODEL), | ||
), | ||
migrations.AlterField( | ||
model_name='comment', | ||
name='postId', | ||
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='post_comments', to='blog.post'), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,25 @@ | ||
# django #selenium #webscraping | ||
from rest_framework import serializers | ||
from django.contrib.auth.models import User, Group | ||
from taggit.serializers import (TagListSerializerField, | ||
TaggitSerializer) | ||
from .models import Post, Comment | ||
|
||
|
||
class PostSerializer(serializers.ModelSerializer): | ||
class CommentSerializer(serializers.ModelSerializer): | ||
author = serializers.UUIDField() | ||
|
||
class Meta: | ||
model = Post | ||
model = Comment | ||
# fields = ('id', 'title', 'description', 'completed') | ||
# Shortcut for getting all fields | ||
fields = '__all__' | ||
|
||
|
||
class CommentSerializer(serializers.ModelSerializer): | ||
class PostSerializer(TaggitSerializer, serializers.ModelSerializer): | ||
tags = TagListSerializerField() | ||
comments = CommentSerializer(many=True, read_only=True) | ||
author = serializers.UUIDField() | ||
|
||
class Meta: | ||
model = Comment | ||
# fields = ('id', 'title', 'description', 'completed') | ||
# Shortcut for getting all fields | ||
fields = '__all__' | ||
model = Post | ||
fields = ('title', "author", "slug", "comments", "tags", "status") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.