Wonderful! That fixed the issue with the forms file. Thanks a lot I still can't see the drop down menu though because there is another console error saying: Uncaught Error: You cannot apply bindings multiple times to the same element.
which is kind of weird because I don't think I applied multiple bindings to the same element. On Thu, Jan 21, 2016 at 8:11 PM, Adam Cox <[email protected]> wrote: > Oh, it looks like resource.py originally has this line: > from arches_hip.models import forms > you'll need to comment that out and add > import forms > in order to reference the correct forms.py file. > > Hopefully that should do it. The select2 error should be solved too. > > Adam > > On Thu, Jan 21, 2016 at 11:57 AM, Mai Abdelaziz El Kady < > [email protected]> wrote: > >> Hi Adam, >> >> Thanks a lot for your quick response. >> I am not using Apache, I am using the default django development server, >> so I am not sure why this is happening. I should probably mention that the >> resource.py in the same directory as forms.py have a corresponding >> resource.pyc file, which got me thinking that maybe there is something >> wrong with the forms.py file, but I can't detect that anyway, I only >> changed a few lines. >> >> As for the error messages from the console, this was it: Uncaught >> cdnjs.cloudflare.com/ajax/libs/knockout/3.3.0/knockout-min.js:66 query >> function not defined for Select2 undefined. >> >> But like you said, I should probably fix the issue in the forms.py first. >> I'd appreciate it if you have more ideas about what could be wrong. >> >> Thanks a lot >> -- >> Mai >> >> >> On Thu, Jan 21, 2016 at 7:36 PM, Adam Cox <[email protected]> wrote: >> >>> Hi Mai, >>> >>> First, yes, the lack of .pyc file indicates that your forms.py file has >>> not been referenced. If you are using apache to serve your app, you'll >>> need to restart apache each time your change a .py file. If you're running >>> the dev server, it will recognize changes to .py files and reset itself >>> (you can see this happen in the console). >>> >>> Second, I'd recommend turning on developer tools in whatever browser you >>> are using and check out the console. You will probably see an error there, >>> which may (or may not!) be helpful in figuring out what's going on. One >>> note, I was actually just editing the classification form, and it's a >>> little more complex because it's a wizard form. You'll see that in the js >>> file, there is actually one more place that you need to reference your new >>> node. >>> >>> Still, the forms.py issue is probably the first thing to tackle... >>> >>> On Thu, Jan 21, 2016 at 11:26 AM, Mai Abdelaziz El Kady < >>> [email protected]> wrote: >>> >>>> 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.
