Projet

Général

Profil

0002-agent-common-store-new-role-field-details-9503.patch

Benjamin Dauvergne, 06 janvier 2016 13:31

Télécharger (2,59 ko)

Voir les différences:

Subject: [PATCH 2/5] agent/common: store new role field "details" (#9503)

 .../common/management/commands/hobo_notify.py      |  3 +++
 .../common/migrations/0002_auto_20160105_1702.py   | 26 ++++++++++++++++++++++
 hobo/agent/common/models.py                        |  3 ++-
 3 files changed, 31 insertions(+), 1 deletion(-)
 create mode 100644 hobo/agent/common/migrations/0002_auto_20160105_1702.py
hobo/agent/common/management/commands/hobo_notify.py
136 136
                    if role.description != o['description']:
137 137
                        role.description = o['description']
138 138
                        save = True
139
                    if role.details != o.get('details', u''):
140
                        role.details = o.get('details', u'')
141
                        save = True
139 142
                    if save:
140 143
                        role.save()
141 144
        if full and action == 'provision':
hobo/agent/common/migrations/0002_auto_20160105_1702.py
1
# -*- coding: utf-8 -*-
2
from __future__ import unicode_literals
3

  
4
from django.db import models, migrations
5

  
6

  
7
class Migration(migrations.Migration):
8

  
9
    dependencies = [
10
        ('common', '0001_initial'),
11
    ]
12

  
13
    operations = [
14
        migrations.AddField(
15
            model_name='role',
16
            name='details',
17
            field=models.TextField(default=''),
18
            preserve_default=True,
19
        ),
20
        migrations.AlterField(
21
            model_name='role',
22
            name='description',
23
            field=models.TextField(default=''),
24
            preserve_default=True,
25
        ),
26
    ]
hobo/agent/common/models.py
4 4

  
5 5
class Role(Group):
6 6
    uuid = models.CharField(max_length=32)
7
    description = models.TextField()
7
    description = models.TextField(default=u'')
8
    details = models.TextField(default=u'')
8
-