user gets automatically written, not in the form anymore
This commit is contained in:
parent
d0fb14bf17
commit
f60623d485
4 changed files with 11 additions and 6 deletions
|
@ -38,7 +38,7 @@ class ExternForm(FdbForm):
|
|||
|
||||
class Meta:
|
||||
model = ConcreteExtern
|
||||
exclude = ('granted', 'granted_date', 'survey_mail_send', 'service_id', 'survey_mail_date', 'mail_state')
|
||||
exclude = ('username', 'granted', 'granted_date', 'survey_mail_send', 'service_id', 'survey_mail_date', 'mail_state')
|
||||
|
||||
|
||||
INTERN_CHOICES = {'PRO': 'Projektsteckbrief',
|
||||
|
|
|
@ -5,7 +5,7 @@ from django.shortcuts import redirect
|
|||
from django.utils.deprecation import MiddlewareMixin
|
||||
from foerderbarometer import settings
|
||||
from input import views
|
||||
|
||||
from input import models
|
||||
|
||||
class OAuthMiddleware(MiddlewareMixin):
|
||||
|
||||
|
@ -33,8 +33,8 @@ class OAuthMiddleware(MiddlewareMixin):
|
|||
print('oi')
|
||||
self.clear_session(request)
|
||||
request.session['token'] = sso_client.authorize_access_token(request)
|
||||
print('blub', request.session['token'])
|
||||
print('user', self.get_current_user(sso_client, request))
|
||||
# print('blub', request.session['token'])
|
||||
models.Extern.username = self.get_current_user(sso_client, request)['username']
|
||||
if self.get_current_user(sso_client, request) is not None:
|
||||
redirect_uri = request.session.pop('redirect_uri', None)
|
||||
if redirect_uri is not None:
|
||||
|
|
|
@ -13,11 +13,12 @@ EMAIL_STATES = {'NONE': 'noch keine Mail versendet',
|
|||
|
||||
class Volunteer(models.Model):
|
||||
realname = models.CharField(max_length=200, null=True, verbose_name="Realname",
|
||||
help_text="Bitte gib deinen Vornamen und deinen Nachnamen ein.")
|
||||
help_text="Bitte gib deinen Vornamen und deinen Nachnamen ein.", default='oi')
|
||||
email = models.EmailField(max_length=200, null=True, verbose_name='E-Mail-Adresse',
|
||||
help_text=format_html('Bitte gib deine E-Mail-Adresse ein, damit dich<br>Wikimedia Deutschland bei Rückfragen oder für<br>die Zusage kontaktieren kann.'))
|
||||
|
||||
# the following Fields are not supposed to be edited by users
|
||||
|
||||
granted = models.BooleanField(null=True, verbose_name='bewilligt')
|
||||
granted_date = models.DateField(null=True, verbose_name='bewilligt am')
|
||||
survey_mail_date = models.DateField(verbose_name='Umfragemail wurde verschickt am', null=True, blank=True)
|
||||
|
@ -36,10 +37,12 @@ class Volunteer(models.Model):
|
|||
abstract = True
|
||||
|
||||
|
||||
|
||||
class Extern(Volunteer):
|
||||
''' abstract basis class for all data entered by extern volunteers '''
|
||||
|
||||
username = models.CharField(max_length=200, null=True, verbose_name='Benutzer_innenname',
|
||||
help_text=format_html("Bitte gib den Namen ein, mit dem du dich<br>in den Wikimedia-Projekten registriert hast."))
|
||||
help_text=format_html("Wikimedia Benutzer_innenname"))
|
||||
|
||||
# the following Fields are not supposed to be edited by users
|
||||
service_id = models.CharField(max_length=15, null=True, blank=True)
|
||||
|
|
|
@ -217,6 +217,8 @@ class ExternView(CookieWizardView):
|
|||
for form in form_list:
|
||||
data = {**data, **form.cleaned_data}
|
||||
|
||||
data['username'] = self.request.session['user']['username']
|
||||
|
||||
if data['choice'] == 'LIT':
|
||||
if data['selfbuy'] == 'TRUE':
|
||||
data['selfbuy_give_data'] = 'False'
|
||||
|
|
Loading…
Reference in a new issue