Untitled

 avatar
unknown
plain_text
a year ago
1.2 kB
5
Indexable
# Create directory for templates
!mkdir -p templates

# Create index.html
with open('templates/index.html', 'w') as f:
    f.write('''
<!DOCTYPE html>
<html>
<head>
    <title>Artwork Distribution</title>
</head>
<body>
    <h1>Artwork Distribution</h1>
    <form action="{{ url_for('submit') }}" method="post">
        {% for child in children %}
            <h3>{{ child }}'s Preferences</h3>
            {% for artwork in artworks %}
                <label>
                    <input type="checkbox" name="{{ child }}" value="{{ artwork.name }}">
                    {{ artwork.name }} (Value: {{ artwork.value }})
                </label><br>
            {% endfor %}
        {% endfor %}
        <button type="submit">Submit Preferences</button>
    </form>
</body>
</html>
''')

# Create result.html
with open('templates/result.html', 'w') as f:
    f.write('''
<!DOCTYPE html>
<html>
<head>
    <title>Distribution Result</title>
</head>
<body>
    <h1>Distribution Result</h1>
    <ul>
        {% for artwork, winner in distribution.items() %}
            <li>{{ artwork }} is awarded to {{ winner }}</li>
        {% endfor %}
    </ul>
    <a href="{{ url_for('index') }}">Back to Home</a>
</body>
</html>
''')
Editor is loading...
Leave a Comment