Added Lisätty to member data
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.9 on 2016-09-15 16:06
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.utils.timezone
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('members', '0003_memberrequest'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RemoveField(
|
||||
model_name='memberrequest',
|
||||
name='submitted',
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='member',
|
||||
name='created',
|
||||
field=models.DateTimeField(default=django.utils.timezone.now),
|
||||
),
|
||||
]
|
||||
+12
-12
@@ -14,17 +14,19 @@ class Member(models.Model):
|
||||
POR = models.CharField(max_length=255) # place of residence
|
||||
AYY = models.BooleanField(default=False)
|
||||
jas = models.BooleanField(default=False)
|
||||
|
||||
created = models.DateTimeField(default=timezone.now)
|
||||
|
||||
def get_dict(self):
|
||||
return {
|
||||
'id':self.id,
|
||||
'first_name':self.first_name,
|
||||
'last_name':self.last_name,
|
||||
'email':self.email,
|
||||
'POR':self.POR,
|
||||
'AYY':self.AYY,
|
||||
'jas':self.jas,
|
||||
}
|
||||
return {
|
||||
'id':self.id,
|
||||
'first_name':self.first_name,
|
||||
'last_name':self.last_name,
|
||||
'email':self.email,
|
||||
'POR':self.POR,
|
||||
'AYY':self.AYY,
|
||||
'jas':self.jas,
|
||||
'created':self.created.isoformat(' '),
|
||||
}
|
||||
|
||||
@classmethod
|
||||
def create_from_dict(cls,d):
|
||||
@@ -77,11 +79,9 @@ class Member(models.Model):
|
||||
|
||||
class MemberRequest(models.Model):
|
||||
member = models.ForeignKey(Member)
|
||||
submitted = models.DateTimeField(default=timezone.now)
|
||||
|
||||
def get_dict(self):
|
||||
return {
|
||||
'id': self.id,
|
||||
'member': self.member.get_dict(),
|
||||
'submitted': self.submitted.isoformat(" ")
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
<div class="col-sm-4">Asuinpaikka: {{ x.member.POR }}</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-4">Lähetetty: {{ x.submitted }}</div>
|
||||
<div class="col-sm-4">Lisätty: {{ x.member.created }}</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-4">
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
<th>AYY-jäsen</th>
|
||||
<th>JAS-listalla</th>
|
||||
<th>Asuinpaikka</th>
|
||||
<th>Lisätty</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -19,6 +20,7 @@
|
||||
<td>{{ x.AYY }}</td>
|
||||
<td>{{ x.jas }}</td>
|
||||
<td>{{ x.POR }}</td>
|
||||
<td>{{ x.created }}</td>
|
||||
<td>
|
||||
<a href="#/edit/{{x.id}}"<input type="button" value="Edit" class="btn btn-info">Muokkaa</input></a>
|
||||
<input type="button" value="Poista" class="btn btn-danger" confirmed-click="delete_member(x.id)" ng-confirm-click="Are you sure?"/>
|
||||
|
||||
@@ -4,27 +4,27 @@
|
||||
<form name="memberForm">
|
||||
<div class="form-group">
|
||||
<label>Etunimi: </label>
|
||||
<input id="firstNameField" required type="text" placeholder="Sähkö" class="form-control" ng-model="firstName"></input>
|
||||
<input id="firstNameField" required type="text" placeholder="Sähkö" class="form-control" ng-model="member.first_name"></input>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Sukunimi: </label>
|
||||
<input id="lastNameField" required type="text" placeholder="Insinööri" class="form-control" ng-model="lastName"></input>
|
||||
<input id="lastNameField" required type="text" placeholder="Insinööri" class="form-control" ng-model="member.last_name"></input>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Sähköposti: </label>
|
||||
<input id="emailField" required type="text" placeholder="sahko.insinoori@aalto.fi" class="form-control" ng-model="email"></input>
|
||||
<input id="emailField" required type="text" placeholder="sahko.insinoori@aalto.fi" class="form-control" ng-model="member.email"></input>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>AYY jäsen: </label>
|
||||
<input type="checkbox" id="AYY" value="0" ng-model="AYY"></input>
|
||||
<input type="checkbox" id="AYY" value="0" ng-model="member.AYY"></input>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>JAS-listaan: </label>
|
||||
<input type="checkbox" id="JAS" value="0" ng-model="JAS"></input>
|
||||
<input type="checkbox" id="JAS" value="0" ng-model="member.jas"></input>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Asuinkunta: </label>
|
||||
<input id="PORField" required type="text" placeholder="Otaniemi" class="form-control" ng-model="POR"></input>
|
||||
<input id="PORField" required type="text" placeholder="Otaniemi" class="form-control" ng-model="member.POR"></input>
|
||||
</div>
|
||||
<button ng-click="memberForm.$valid && send()" type="submit" class="btn btn-success" id="sendmember">Tallenna</button>
|
||||
</form>
|
||||
|
||||
@@ -27,18 +27,11 @@ var notySuccess = notyfication('success',2500);
|
||||
//controllers
|
||||
|
||||
app.controller("applicationController", function($scope, $http, $location, $window) {
|
||||
$scope.firstName = "";
|
||||
$scope.lastName = "";
|
||||
$scope.email = "";
|
||||
//$scope.year = "1";
|
||||
$scope.AYY = "";
|
||||
$scope.JAS = "";
|
||||
$scope.POR = "";
|
||||
$scope.member = {};
|
||||
$scope.send = function() {
|
||||
$http.post("/members/api/request", {"first_name":$scope.firstName, "last_name":$scope.lastName, "email":$scope.email, /*"year":$scope.year,*/ "AYY":$scope.AYY, "jas":$scope.JAS, "POR":$scope.POR}).then(function(data){
|
||||
$http.post("/members/api/request", $scope.member).then(function(data){
|
||||
notySuccess("Hakemus lähetetty!");
|
||||
$window.location.href = "/application/";
|
||||
//$route.reload();
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -93,14 +93,9 @@ app.controller("getController", function($scope, $http, $window, $location){
|
||||
});
|
||||
|
||||
app.controller("postController", function($scope, $http, $location) {
|
||||
$scope.firstName = "";
|
||||
$scope.lastName = "";
|
||||
$scope.email = "";
|
||||
$scope.AYY = "";
|
||||
$scope.JAS = "";
|
||||
$scope.POR = "";
|
||||
$scope.member = {};
|
||||
$scope.send = function() {
|
||||
$http.post("/members/api/member/", {"first_name":$scope.firstName, "last_name":$scope.lastName, "email":$scope.email, "AYY":$scope.AYY, "jas":$scope.JAS, "POR":$scope.POR}).then(function(data){
|
||||
$http.post("/members/api/member/", $scope.member).then(function(data){
|
||||
notySuccess("Jäsen lisätty!");
|
||||
$location.path("/list");
|
||||
});
|
||||
|
||||
@@ -27,18 +27,18 @@
|
||||
<form name="applicationForm">
|
||||
<div class="form-group">
|
||||
<label>Etunimi: </label>
|
||||
<input id="firstNameField" required type="text" placeholder="Sähkö" class="form-control" ng-model="firstName"></input>
|
||||
<input id="firstNameField" required type="text" placeholder="Sähkö" class="form-control" ng-model="member.first_name"></input>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Sukunimi: </label>
|
||||
<input id="lastNameField" required type="text" placeholder="Insinööri" class="form-control" ng-model="lastName"></input>
|
||||
<input id="lastNameField" required type="text" placeholder="Insinööri" class="form-control" ng-model="member.last_name"></input>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Sähköposti: </label>
|
||||
<input id="emailField" required type="text" placeholder="sahko.insinoori@aalto.fi" class="form-control" ng-model="email"></input>
|
||||
<input id="emailField" required type="text" placeholder="sahko.insinoori@aalto.fi" class="form-control" ng-model="member.email"></input>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<!--<label>Vuosikurssi: </label>
|
||||
<!--<div class="form-group">
|
||||
<label>Vuosikurssi: </label>
|
||||
<select name="year" ng-model="year">
|
||||
<option value="1">1</option>
|
||||
<option value="2">2</option>
|
||||
@@ -49,15 +49,15 @@
|
||||
</div>-->
|
||||
<div class="form-group">
|
||||
<label>Olen AYY:n jäsen: </label>
|
||||
<input type="checkbox" id="AYY" value="0" ng-model="AYY"></input>
|
||||
<input type="checkbox" id="AYY" value="0" ng-model="member.AYY"></input>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Haluan saada viikottaisia jäsenmaileja: </label>
|
||||
<input type="checkbox" id="JAS" value="0" ng-model="JAS"></input>
|
||||
<input type="checkbox" id="JAS" value="0" ng-model="member.jas"></input>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Asuinkunta: </label>
|
||||
<input id="PORField" required type="text" placeholder="Otaniemi" class="form-control" ng-model="POR"></input>
|
||||
<input id="PORField" required type="text" placeholder="Otaniemi" class="form-control" ng-model="member.POR"></input>
|
||||
</div>
|
||||
<button ng-click="applicationForm.$valid && send()" type="submit" class="btn btn-success" id="sendmember">Tallenna</button>
|
||||
</form>
|
||||
|
||||
Reference in New Issue
Block a user