mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-25 19:11:09 +00:00
parent
c07aa387fa
commit
95c8dc1d67
3 changed files with 6 additions and 6 deletions
|
@ -2,9 +2,8 @@
|
|||
from datetime import datetime
|
||||
from django.core.validators import MaxValueValidator, MinValueValidator
|
||||
from django.db import models
|
||||
from django.dispatch import receiver
|
||||
from model_utils.managers import InheritanceManager
|
||||
import re
|
||||
import urllib.parse
|
||||
|
||||
from fedireads.utils.models import FedireadsModel
|
||||
|
||||
|
@ -20,7 +19,7 @@ class Status(FedireadsModel):
|
|||
local = models.BooleanField(default=True)
|
||||
privacy = models.CharField(max_length=255, default='public')
|
||||
sensitive = models.BooleanField(default=False)
|
||||
# the created date can't double as this, because of receiving federated posts
|
||||
# the created date can't be this, because of receiving federated posts
|
||||
published_date = models.DateTimeField(default=datetime.now)
|
||||
favorites = models.ManyToManyField(
|
||||
'User',
|
||||
|
@ -51,6 +50,7 @@ class Review(Status):
|
|||
self.activity_type = 'Article'
|
||||
super().save(*args, **kwargs)
|
||||
|
||||
|
||||
class Favorite(FedireadsModel):
|
||||
''' fav'ing a post '''
|
||||
user = models.ForeignKey('User', on_delete=models.PROTECT)
|
||||
|
@ -70,7 +70,7 @@ class Tag(FedireadsModel):
|
|||
def save(self, *args, **kwargs):
|
||||
if not self.id:
|
||||
# add identifiers to new tags
|
||||
self.identifier = re.sub(r'\W+', '-', self.name).lower()
|
||||
self.identifier = urllib.parse.quote_plus(self.name)
|
||||
super().save(*args, **kwargs)
|
||||
|
||||
class Meta:
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<div class="tag">
|
||||
<a href="/tag/{{ tag.identifier }}">{{ tag.name }}</a>
|
||||
<a href="/tag/{{ tag.identifier|urlencode }}">{{ tag.name }}</a>
|
||||
{% if tag.identifier in user_tags %}
|
||||
<form class="tag-form" name="tag" action="/untag/" method="post">
|
||||
{% csrf_token %}
|
||||
|
|
|
@ -45,7 +45,7 @@ urlpatterns = [
|
|||
re_path(r'^book/(?P<book_identifier>\w+)/?$', views.book_page),
|
||||
re_path(r'^book/(?P<book_identifier>\w+)/(?P<tab>friends|local|federated)?$', views.book_page),
|
||||
re_path(r'^author/(?P<author_identifier>\w+)/?$', views.author_page),
|
||||
re_path(r'^tag/(?P<tag_id>[\w-]+)/?$', views.tag_page),
|
||||
re_path(r'^tag/(?P<tag_id>.+)/?$', views.tag_page),
|
||||
re_path(r'^shelf/%s/(?P<shelf_identifier>[\w-]+)/?$' % username_regex, views.shelf_page),
|
||||
|
||||
# internal action endpoints
|
||||
|
|
Loading…
Reference in a new issue