mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-10-31 22:19:00 +00:00
Merge branch 'main' into production
This commit is contained in:
commit
636de3ae54
4 changed files with 27 additions and 5 deletions
20
bookwyrm/migrations/0033_siteinvite_created_date.py
Normal file
20
bookwyrm/migrations/0033_siteinvite_created_date.py
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
# Generated by Django 3.0.7 on 2021-01-05 19:08
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
import django.utils.timezone
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('bookwyrm', '0032_auto_20210104_2055'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='siteinvite',
|
||||||
|
name='created_date',
|
||||||
|
field=models.DateTimeField(auto_now_add=True, default=django.utils.timezone.now),
|
||||||
|
preserve_default=False,
|
||||||
|
),
|
||||||
|
]
|
|
@ -50,6 +50,7 @@ def new_access_code():
|
||||||
|
|
||||||
class SiteInvite(models.Model):
|
class SiteInvite(models.Model):
|
||||||
''' gives someone access to create an account on the instance '''
|
''' gives someone access to create an account on the instance '''
|
||||||
|
created_date = models.DateTimeField(auto_now_add=True)
|
||||||
code = models.CharField(max_length=32, default=new_access_code)
|
code = models.CharField(max_length=32, default=new_access_code)
|
||||||
expiry = models.DateTimeField(blank=True, null=True)
|
expiry = models.DateTimeField(blank=True, null=True)
|
||||||
use_limit = models.IntegerField(blank=True, null=True)
|
use_limit = models.IntegerField(blank=True, null=True)
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="tile is-5 is-parent">
|
<div class="tile is-5 is-parent">
|
||||||
<div class="tile is-child box has-background-primary-light">
|
<div class="tile is-child box has-background-primary-light content">
|
||||||
{% if site.allow_registration %}
|
{% if site.allow_registration %}
|
||||||
<h2 class="title">Join {{ site.name }}</h2>
|
<h2 class="title">Join {{ site.name }}</h2>
|
||||||
<form name="register" method="post" action="/user-register">
|
<form name="register" method="post" action="/user-register">
|
||||||
|
@ -21,7 +21,7 @@
|
||||||
</form>
|
</form>
|
||||||
{% else %}
|
{% else %}
|
||||||
<h2 class="title">This instance is closed</h2>
|
<h2 class="title">This instance is closed</h2>
|
||||||
<p>{{ site.registration_closed_text }}</p>
|
<p>{{ site.registration_closed_text | safe}}</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -399,7 +399,8 @@ def manage_invites(request):
|
||||||
''' invite management page '''
|
''' invite management page '''
|
||||||
data = {
|
data = {
|
||||||
'title': 'Invitations',
|
'title': 'Invitations',
|
||||||
'invites': models.SiteInvite.objects.filter(user=request.user),
|
'invites': models.SiteInvite.objects.filter(
|
||||||
|
user=request.user).order_by('-created_date'),
|
||||||
'form': forms.CreateInviteForm(),
|
'form': forms.CreateInviteForm(),
|
||||||
}
|
}
|
||||||
return TemplateResponse(request, 'manage_invites.html', data)
|
return TemplateResponse(request, 'manage_invites.html', data)
|
||||||
|
@ -466,9 +467,9 @@ def user_page(request, username):
|
||||||
|
|
||||||
# user's posts
|
# user's posts
|
||||||
activities = get_activity_feed(
|
activities = get_activity_feed(
|
||||||
user,
|
request.user,
|
||||||
['public', 'unlisted', 'followers'],
|
['public', 'unlisted', 'followers'],
|
||||||
queryset=models.Status.objects.filter(user=request.user)
|
queryset=models.Status.objects.filter(user=user)
|
||||||
)
|
)
|
||||||
paginated = Paginator(activities, PAGE_LENGTH)
|
paginated = Paginator(activities, PAGE_LENGTH)
|
||||||
activity_page = paginated.page(page)
|
activity_page = paginated.page(page)
|
||||||
|
|
Loading…
Reference in a new issue