Hi Adam & Alexei,
So far I've made changes to forms.py, classification.htm and
classification.js and uncommented the RESOURCE_MODEL line in settings.py,
but something is not working correctly, I don't think that my new additions
in forms.py are taken into consideration. I am modifying the classification
form to add a new field: dynasty, which is a new node on the resource graph
that I have previously added and I also added its corresponding authority
documents.
However I noticed that when I load the page all seem to work well except
for the dynasty field (there is no drop down list and even the place holder
text is not visible). I also noticed that in my project's models directory
where the new forms.py is, there is no forms.pyc, would that indicate that
it wasn't interpreted or something?
I have included below the parts of the 3 files that I have modified, but
basically I was following the steps in this thread(
https://groups.google.com/forum/#!searchin/archesproject/forms.py/archesproject/_YyRG8wFUGs/EhXHFmB6w28J
):
forms.py:
class ClassificationForm(ResourceForm):
def update(self, data, files):
self.update_nodes('HERITAGE_RESOURCE_TYPE.E55', data)
self.update_nodes('TO_DATE.E49', data)
self.update_nodes('FROM_DATE.E49', data)
self.update_nodes('HERITAGE_RESOURCE_USE_TYPE.E55', data)
self.update_nodes('CULTURAL_PERIOD.E55', data)
self.update_nodes('STYLE.E55', data)
self.update_nodes('ANCILLARY_FEATURE_TYPE.E55', data)
self.update_nodes('DYNASTY.E55', data) #added this
def load(self, lang):
self.data = {
'data': [],
'domains': {
'HERITAGE_RESOURCE_TYPE.E55':
Concept().get_e55_domain('HERITAGE_RESOURCE_TYPE.E55'),
'HERITAGE_RESOURCE_USE_TYPE.E55' :
Concept().get_e55_domain('HERITAGE_RESOURCE_USE_TYPE.E55'),
'CULTURAL_PERIOD.E55' :
Concept().get_e55_domain('CULTURAL_PERIOD.E55'),
'STYLE.E55' : Concept().get_e55_domain('STYLE.E55'),
'ANCILLARY_FEATURE_TYPE.E55' :
Concept().get_e55_domain('ANCILLARY_FEATURE_TYPE.E55'),
'DYNASTY.E55' : Concept().get_e55_domain('DYNASTY.E55')
}
}
classification_entities =
self.resource.find_entities_by_type_id('PHASE_TYPE_ASSIGNMENT.E17')
for entity in classification_entities:
to_date_nodes = datetime_nodes_to_dates(self.get_nodes(entity,
'TO_DATE.E49'))
from_date_nodes =
datetime_nodes_to_dates(self.get_nodes(entity, 'FROM_DATE.E49'))
self.data['data'].append({
'HERITAGE_RESOURCE_TYPE.E55': {
'branch_lists': self.get_nodes(entity,
'HERITAGE_RESOURCE_TYPE.E55')
},
'HERITAGE_RESOURCE_USE_TYPE.E55': {
'branch_lists': self.get_nodes(entity,
'HERITAGE_RESOURCE_USE_TYPE.E55')
},
'CULTURAL_PERIOD.E55': {
'branch_lists': self.get_nodes(entity,
'CULTURAL_PERIOD.E55')
},
'TO_DATE.E49': {
'branch_lists': to_date_nodes
},
'FROM_DATE.E49': {
'branch_lists': from_date_nodes
},
'STYLE.E55': {
'branch_lists': self.get_nodes(entity, 'STYLE.E55')
},
'ANCILLARY_FEATURE_TYPE.E55': {
'branch_lists': self.get_nodes(entity,
'ANCILLARY_FEATURE_TYPE.E55')
},
'PHASE_TYPE_ASSIGNMENT.E17': {
'branch_lists': self.get_nodes(entity,
'PHASE_TYPE_ASSIGNMENT.E17')
},
'DYNASTY.E55': {
'branch_lists': self.get_nodes(entity, 'DYNASTY.E55')
}
})
classification.htm:
<!--Existing Classifications-->
<dl>
<dt class="arches-evaluation-header">{% trans
"DYNASTY" %}</dt>
<dd class="arches-evaluation-content"
data-bind="if: $data['DYNASTY.E55'].branch_lists.length > 0">
<span data-bind="html:
$data['DYNASTY.E55'].branch_lists[0].nodes[0].label"></span>
</dd>
<dd class="arches-evaluation-content"
data-bind="ifnot: $data['DYNASTY.E55'].branch_lists.length > 0">
<span data-bind="html: 'no entries'"></span>
</dd>
</dl>
and here:
<div id="dynasty-section" class="col-xs-12 col-sm-6">
<div
style="padding-right: 0px; padding-left: 0px;">
<input style="width:100%" class="select2 arches-select2-crud-form"
data-bind="select2: {value: getEditedNode('DYNASTY.E55', 'value'),
placeholder: '{% trans "Dynasty" %}', dataKey: 'DYNASTY.E55'}">
</input>
</div>
<!-- Spacer for xs screens -->
<div
class="margin-top-5 hidden-lg hidden-md hidde-sm"></div>
</div>
classification.js:
this.addBranchList(new BranchList({
el: this.$el.find('#dynasty-section')[0],
data: currentEditedClassification,
dataKey: 'DYNASTY.E55',
singleEdit: true
}));
Thanks a lot
--
Mai
On Wed, Jan 20, 2016 at 9:35 PM, Adam Cox <[email protected]> wrote:
> Hi Mai, yes, those are the three places you'll need to make changes to
> support new nodes. However, you'll also need to uncomment the
> RESOURCE_MODEL line in your app's settings.py file, to make sure that it
> points to the location of your new resource.py file.
>
> If you've done all of these things but are still having trouble, let us
> know what errors you're finding.
> Adam
>
> On Wed, Jan 20, 2016 at 9:01 AM, <[email protected]> wrote:
>
>> Hello All,
>>
>> I just wanted to make sure that I am following the correct steps after
>> adding new nodes to the resource graphs, According to my understanding and
>> to reading some responses on the group here, I know that I should make
>> changes in forms.py, and to some html and js files.
>> I have modified html and js files with no problems before. but there
>> seems to be an issue when I modify the forms.py file.
>> Basically what I did was copy the forms.py and resource.py files from
>> arches-hip to my project directory/models then I made the necessary changes
>> to forms.py.
>> Is there some file somewhere else that I need to modify as well?
>>
>> Thanks
>> --
>> Mai
>>
>> --
>> -- To post, send email to [email protected]. To
>> unsubscribe, send email to [email protected].
>> For more information, visit
>> https://groups.google.com/d/forum/archesproject?hl=en
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "Arches Project" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
--
-- To post, send email to [email protected]. To unsubscribe, send
email to [email protected]. For more information,
visit https://groups.google.com/d/forum/archesproject?hl=en
---
You received this message because you are subscribed to the Google Groups
"Arches Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.