Revision 2a0eee64

b/invitations/invitations.py
3 3
from django.db import transaction
4 4
from django.http import HttpResponse, HttpResponseRedirect
5 5
from django.shortcuts import render_to_response
6
from django.template.loader import render_to_string
6 7
from synnefo.api.common import method_not_allowed
7 8
from synnefo.db.models import Invitations, SynnefoUser
8 9
from synnefo.logic import users
......
24 25

  
25 26
def inv_demux(request):
26 27
    if request.method == 'GET':
27

  
28
        #data = t.render('invitation.html', {'invitations': None})
28
        invitations = Invitations.objects.filter(source = request.user)
29
        data = render_to_string('invitations.html', {'invitations': invitations})
29 30
        return  HttpResponse(data)
30 31
    elif request.method == 'POST':
31 32
        f = InvitationForm(request)
b/invitations/templates/invitations.html
4 4
<head>
5 5
    <title>Αποστολή προσκλήσεων σε χρήστες</title>
6 6
    <script src="/static/jquery.tools.min.js"></script>
7
</head>
8
<body>
9 7

  
10
<script type="text/javascript">
8
    <script type="text/javascript">
11 9

  
12
$(document).ready(function() {
13
    $("#emaillist").click(function(){
14
        $("#emaillist").text('');
10
    $(document).ready(function() {
11
        $("#emaillist").click(function(){
12
            $("#emaillist").text('');
13
        });
15 14
    });
16
});
17 15

  
18
</script>
16
    </script>
19 17

  
18
    <style type="text/css">
19
        
20
    </style>
21
</head>
22
<body>
20 23
{% if error_message %}<div id="error"><strong>{{ error_message }}</strong></div>{% endif %}
21 24

  
22 25
<form id="" action="/invitations/" method="post">
23 26
{% csrf_token %}
24
        <label for="emaillist">Email για αποστολή προσκλήσεων (
25
            <div id="remaining">{% all_invitations.count() %}</div>
26
            ακόμη)
27
        <label for="emaillist">Email για αποστολή προσκλήσεων (διαθέσιμες: 
28
            <span id="remaining">{{ invitations.count }}</span>
29
            )
27 30
        </label>
28 31
        <textarea id="emaillist" rows="24" cols="80">
29 32
Εισάγετε τη λίστα των διευθύνσεων email στις οποίες θέλετε να αποσταλούν προσκλήσεις, μια σε κάθε γραμμή.
......
38 41
</form>
39 42

  
40 43
<div id="invsent">
41
Λίστα προσκλήσεων που έχουν αποσταλεί (<img src="/static/save.png" alt=""> = Η πρόσκληση έγινε αποδεκτή,
42
    <img src="/static/cancel.png" alt=""> = Η πρόσκληση εκκρεμεί)
44
Λίστα προσκλήσεων που έχουν αποσταλεί (<img src="/static/save.png" alt=""> = Η πρόσκληση έγινε αποδεκτή)
43 45
    <div>
44 46
        <ul>
45
        {% for ivn in all_invitations %}
47
        {% for ivn in invitations %}
46 48
            <li>
47 49
                {% if inv.accepted %}
48 50
                    <img src="/static/save.png" alt="">
49
                {% else %}
50
                    <img src="/static/cancel.png" alt="">
51 51
                {% endif %}
52 52
                {{ inv.target }}
53 53
            </li>
b/invitations/urls.py
1 1
from django.conf.urls.defaults import patterns
2
from django.views.generic import list_detail
3 2

  
4
from synnefo.db.models import Invitations
5 3

  
6
all_invitations = {
7
    "queryset" : Invitations.objects.filter(source = request.user),
8
    "template_name" : "invitations.html"
9
}
10

  
11
urlpatterns = patterns('',
12
    (r'^$', list_detail.object_list, all_invitations)
4
urlpatterns = patterns('synnefo.invitations.invitations',
5
    (r'^$', 'inv_demux')
13 6
)

Also available in: Unified diff