Birthdays Widget

The Birthdays widget displays a list of upcoming birthdays. The source of the list and who is included is determined by the user. For details, see the article Home Page Birthdays.

The widget utilizes an HTML file and a Python script as shown below. (No SQL script is needed.) Since the birthday list is different for each user, Caching should be set to each user.

HTML Code

Below is the HTML code for the Birthdays widget. As supplied by TouchPoint, the file name is WidgetBirthdaysHTML.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<div class="box">
    <div class="box-title hidden-xs">
        <h5><a href="/Tags?tag=TrackBirthdays">{{WidgetName}}</a></h5>
    </div>
    <a class="visible-xs-block" id="{{WidgetId}}-collapse" data-toggle="collapse" href="#{{WidgetId}}-section" aria-expanded="true" aria-controls="{{WidgetId}}-section">
        <div class="box-title">
            <h5>
                <i class="fa fa-chevron-circle-right"></i>&nbsp;&nbsp;{{WidgetName}}
            </h5>
            {{#ifGT results.Count 0}}
                <div class="pull-right">
                    <span class="badge badge-primary">{{results.Count}}</span>
                </div>
            {{/ifGT}}
        </div>
    </a>
    <div class="collapse in" id="{{WidgetId}}-section">
        {{#ifGT results.Count 0}}
            <ul class="list-group">
                {{#each results}}
                    <li class="list-group-item"><a target="_blank" href="/Person2/{{PeopleId}}">
                        {{Name}} ({{Birthday}})
                    </a></li>
                {{/each}}
            </ul>
        {{else}}
            <div class="box-content"></div>
        {{/ifGT}}
    </div>
</div>

Python Script

Below is the Python script for the Birthdays widget. It makes use of a builtin Python method, model.BirthdayList(). As supplied by TouchPoint, the file name is WidgetBirthdaysPython.

1
2
3
4
5
6
def Get():
    template = Data.HTMLContent
    Data.results = model.BirthdayList()
    print model.RenderTemplate(template)

Get()


Latest Update 04/30/2020

Added this article.

© 2020 TouchPoint Software, LLC.  All rights reserved.