forked from mirrors/bookwyrm
Adds join directory insert
This commit is contained in:
parent
7263c9fd63
commit
6548291571
2 changed files with 24 additions and 0 deletions
|
@ -11,6 +11,23 @@
|
|||
{% trans "Directory" %}
|
||||
</h1>
|
||||
</header>
|
||||
|
||||
{% if not request.user.discoverable %}
|
||||
<div class="box has-text-centered content">
|
||||
{% url 'settings-profile' as path %}
|
||||
<p>
|
||||
{% trans "Make your profile discoverable so other BookWyrm users can find you." %}
|
||||
</p>
|
||||
<form name="directory" method="POST" action="{% url 'directory' %}">
|
||||
{% csrf_token %}
|
||||
<button class="button is-primary" type="submit">Join Directory</button>
|
||||
<p class="help">
|
||||
{% blocktrans %}You can opt-out at any time in your <a href="{{ path }}">profile settings</a>{% endblocktrans %}
|
||||
</p>
|
||||
</form>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="columns is-multiline">
|
||||
{% for user in users %}
|
||||
<div class="column is-one-third">
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
""" who all's here? """
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.core.paginator import Paginator
|
||||
from django.shortcuts import redirect
|
||||
from django.template.response import TemplateResponse
|
||||
from django.views import View
|
||||
from django.utils.decorators import method_decorator
|
||||
|
@ -30,3 +31,9 @@ class Directory(View):
|
|||
"users": paginated.page(page),
|
||||
}
|
||||
return TemplateResponse(request, "directory.html", data)
|
||||
|
||||
def post(self, request):
|
||||
""" join the directory """
|
||||
request.user.discoverable = True
|
||||
request.user.save()
|
||||
return redirect('directory')
|
||||
|
|
Loading…
Reference in a new issue