Merge branch 'setup' of https://bitbucket.org/PekopT/archilance into setup
commit
f9fa7ce0e7
15 changed files with 234 additions and 45 deletions
@ -0,0 +1,38 @@ |
||||
# -*- coding: utf-8 -*- |
||||
# Generated by Django 1.9.6 on 2016-07-08 13:53 |
||||
from __future__ import unicode_literals |
||||
|
||||
import datetime |
||||
from django.db import migrations, models |
||||
import django.utils.timezone |
||||
from django.utils.timezone import utc |
||||
|
||||
|
||||
class Migration(migrations.Migration): |
||||
|
||||
dependencies = [ |
||||
('users', '0018_auto_20160630_1846'), |
||||
] |
||||
|
||||
operations = [ |
||||
# migrations.RemoveField( |
||||
# model_name='user', |
||||
# name='nickname', |
||||
# ), |
||||
# migrations.AddField( |
||||
# model_name='user', |
||||
# name='data_joined', |
||||
# field=models.DateTimeField(default=django.utils.timezone.now), |
||||
# ), |
||||
# migrations.AddField( |
||||
# model_name='user', |
||||
# name='username', |
||||
# field=models.CharField(default=datetime.datetime(2016, 7, 8, 13, 53, 51, 625003, tzinfo=utc), max_length=50, unique=True), |
||||
# preserve_default=False, |
||||
# ), |
||||
migrations.AlterField( |
||||
model_name='user', |
||||
name='date_of_birth', |
||||
field=models.DateTimeField(blank=True, null=True), |
||||
), |
||||
] |
||||
@ -0,0 +1,27 @@ |
||||
from django.shortcuts import redirect, render_to_response |
||||
|
||||
from social.pipeline.partial import partial |
||||
|
||||
@partial |
||||
def test_contractor(backend, details, response, is_new=False, *args, **kwargs): |
||||
import code; code.interact(local=dict(globals(), **locals())) |
||||
|
||||
|
||||
@partial |
||||
def add_email_for_user(backend, details, response, is_new=False, *args, **kwargs): |
||||
data = backend.strategy.request_data() |
||||
if details.get('contractor') is None: |
||||
return render_to_response('add_email_form.html') |
||||
else: |
||||
return {'contractor': details.get('contractor')} |
||||
|
||||
@partial |
||||
def require_email(strategy, details, user=None, is_new=False, *args, **kwargs): |
||||
if kwargs.get('ajax') or user and user.email: |
||||
return |
||||
elif is_new and not details.get('email'): |
||||
email = strategy.request_data().get('email') |
||||
if email: |
||||
details['email'] = email |
||||
else: |
||||
return redirect('require_email') |
||||
@ -0,0 +1,5 @@ |
||||
<h1>Введите свой email</h1> |
||||
<form method="post"> |
||||
<input type="text" name="contractor"> |
||||
<input type="submit" value="Send"> |
||||
</form> |
||||
@ -0,0 +1,6 @@ |
||||
{% extends 'partials/base.html' %} |
||||
|
||||
{% block content %} |
||||
<h1>Upload Files</h1> |
||||
|
||||
{% endblock %} |
||||
Loading…
Reference in new issue