Adds join directory insert
This commit is contained in:
parent
7263c9fd63
commit
6548291571
@ -11,6 +11,23 @@
|
|||||||
{% trans "Directory" %}
|
{% trans "Directory" %}
|
||||||
</h1>
|
</h1>
|
||||||
</header>
|
</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">
|
<div class="columns is-multiline">
|
||||||
{% for user in users %}
|
{% for user in users %}
|
||||||
<div class="column is-one-third">
|
<div class="column is-one-third">
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
""" who all's here? """
|
""" who all's here? """
|
||||||
from django.contrib.auth.decorators import login_required
|
from django.contrib.auth.decorators import login_required
|
||||||
from django.core.paginator import Paginator
|
from django.core.paginator import Paginator
|
||||||
|
from django.shortcuts import redirect
|
||||||
from django.template.response import TemplateResponse
|
from django.template.response import TemplateResponse
|
||||||
from django.views import View
|
from django.views import View
|
||||||
from django.utils.decorators import method_decorator
|
from django.utils.decorators import method_decorator
|
||||||
@ -30,3 +31,9 @@ class Directory(View):
|
|||||||
"users": paginated.page(page),
|
"users": paginated.page(page),
|
||||||
}
|
}
|
||||||
return TemplateResponse(request, "directory.html", data)
|
return TemplateResponse(request, "directory.html", data)
|
||||||
|
|
||||||
|
def post(self, request):
|
||||||
|
""" join the directory """
|
||||||
|
request.user.discoverable = True
|
||||||
|
request.user.save()
|
||||||
|
return redirect('directory')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user