space create initial name and markup

This commit is contained in:
vabene1111
2021-07-22 16:39:42 +02:00
parent 28e6c9d922
commit 781cbc16f7
2 changed files with 4 additions and 3 deletions

View File

@@ -32,7 +32,7 @@
</div> </div>
<div class="card-body"> <div class="card-body">
<h5 class="card-title">{% trans 'Join an existing space.' %}</h5> <h5 class="card-title">{% trans 'Join an existing space.' %}</h5>
<p class="card-text">{% trans 'To join an existing space either enter your invite token or click on the invite link the space owner send you.' %}</p> <p class="card-text" style="height: 64px">{% trans 'To join an existing space either enter your invite token or click on the invite link the space owner send you.' %}</p>
<form method="POST" action="{% url 'view_no_space' %}"> <form method="POST" action="{% url 'view_no_space' %}">
{% csrf_token %} {% csrf_token %}
@@ -49,7 +49,7 @@
</div> </div>
<div class="card-body"> <div class="card-body">
<h5 class="card-title">{% trans 'Create your own recipe space.' %}</h5> <h5 class="card-title">{% trans 'Create your own recipe space.' %}</h5>
<p class="card-text">{% trans 'Start your own recipe space and invite other users to it.' %}</p> <p class="card-text" style="height: 64px">{% trans 'Start your own recipe space and invite other users to it.' %}</p>
<form method="POST" action="{% url 'view_no_space' %}"> <form method="POST" action="{% url 'view_no_space' %}">
{% csrf_token %} {% csrf_token %}
{{ create_form | crispy }} {{ create_form | crispy }}

View File

@@ -120,6 +120,7 @@ def no_space(request):
max_users=settings.SPACE_DEFAULT_MAX_USERS, max_users=settings.SPACE_DEFAULT_MAX_USERS,
allow_sharing=settings.SPACE_DEFAULT_ALLOW_SHARING, allow_sharing=settings.SPACE_DEFAULT_ALLOW_SHARING,
) )
request.user.userpreference.space = created_space request.user.userpreference.space = created_space
request.user.userpreference.save() request.user.userpreference.save()
request.user.groups.add(Group.objects.filter(name='admin').get()) request.user.groups.add(Group.objects.filter(name='admin').get())
@@ -139,7 +140,7 @@ def no_space(request):
if 'signup_token' in request.session: if 'signup_token' in request.session:
return HttpResponseRedirect(reverse('view_invite', args=[request.session.pop('signup_token', '')])) return HttpResponseRedirect(reverse('view_invite', args=[request.session.pop('signup_token', '')]))
create_form = SpaceCreateForm() create_form = SpaceCreateForm(initial={'name': f'{request.user.username}\'s Space'})
join_form = SpaceJoinForm() join_form = SpaceJoinForm()
return render(request, 'no_space_info.html', {'create_form': create_form, 'join_form': join_form}) return render(request, 'no_space_info.html', {'create_form': create_form, 'join_form': join_form})