Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added the tables for msp data and reorganoized the secs and subsecs #232

Merged
merged 3 commits into from
Jan 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions seshat/apps/core/templates/core/partials/_navbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,11 @@
<a class="dropdown-item fw-bold" href="{% url 'wfvars' %}">Warfare Variables (MilTech)</a>
</li>
<li>
<a class="dropdown-item fw-bold" href="{% url 'rtvars' %}">Religion Tolerance</a>
<a class="dropdown-item fw-bold" href="{% url 'rtvars' %}">Religion Variables</a>
</li>
<li>
<a class="dropdown-item fw-bold" href="{% url 'ecvars' %}">Economy Variables </a>
</li>
<li>
<a class="dropdown-item fw-bold" href="{% url 'human_sacrifices_all' %}" aria-current="page">Human Sacrifice</a>
</li>
<li><hr class="dropdown-divider mx-2"></li>

<!-- Subcategory 2: Specific Variables -->
Expand Down
5 changes: 1 addition & 4 deletions seshat/apps/core/templates/core/partials/_navbar_home.html
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,11 @@
<a class="dropdown-item fw-bold" href="{% url 'wfvars' %}">Warfare Variables (MilTech)</a>
</li>
<li>
<a class="dropdown-item fw-bold" href="{% url 'rtvars' %}">Religion Tolerance</a>
<a class="dropdown-item fw-bold" href="{% url 'rtvars' %}">Religion Variables</a>
</li>
<li>
<a class="dropdown-item fw-bold" href="{% url 'ecvars' %}">Economy Variables </a>
</li>
<li>
<a class="dropdown-item fw-bold" href="{% url 'human_sacrifices_all' %}" aria-current="page">Human Sacrifice</a>
</li>
<li><hr class="dropdown-divider mx-2"></li>

<!-- Subcategory 2: Specific Variables -->
Expand Down
10 changes: 5 additions & 5 deletions seshat/apps/core/templates/core/polity/polity_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,8 @@ <h4>
{% endif %}

{% if has_any_rt_data and 'core.view_capital' in user.get_all_permissions or object.new_name == "kh_chenla" or object.new_name == "pe_wari_emp" or object.new_name == "in_kampili_k" or object.new_name == "in_kalyani_chalukya_emp" or object.new_name == "in_hoysala_k" or object.new_name == "et_aksum_emp_3" or object.new_name == "et_aksum_emp_2" or object.new_name == "ni_proto_yoruboid" or object.new_name == "ni_sokoto" or object.new_name == "gm_kaabu_emp" %}
<span type="button" class="mx-0 px-0" tabindex="0" data-bs-toggle="popover" title="Religion Tolerance" data-bs-html="true" data-bs-trigger="focus">
<a href="#rt_var"><span class="badge p-1 mx-0 fs-5 " style="background: #59007f;">RT</span></a>
<span type="button" class="mx-0 px-0" tabindex="0" data-bs-toggle="popover" title="Religion Variables" data-bs-html="true" data-bs-trigger="focus">
<a href="#rt_var"><span class="badge p-1 mx-0 fs-5 " style="background: #59007f;">RG</span></a>
</span>
{% endif %}

Expand Down Expand Up @@ -1243,7 +1243,7 @@ <h5 class="accordion-header" id="flush-headingOne">
<div class="col-md-12 m-0 p-0">
<span class=" h3 fw-bold m-0 p-0 ">
<span class="badge mt-5 mb-2 p-3 fw-bold text-dark" style="text-align: left; background: #59007f3b;">
Religion Tolerance
Religion Variables
</span>
<span class=" mt-3 fs-5">
<a href="#rt_var"><i class="fa-solid fa-circle-arrow-down mt-3 fa-lg"></i></a>
Expand Down Expand Up @@ -1404,7 +1404,7 @@ <h5 class="accordion-header" id="flush-headingOne">
<div class="col-md-9">
<span class=" h3 fw-bold m-0 p-0 text-secondary ">
<span class="badge mt-5 mb-2 p-3 fw-bold text-secondary rounded-pill" style="text-align: left; background: #59007f3b; border:1px solid #59007f">
Religion Tolerance
Religion Variables
</span>
<span class=" mt-3 fs-5">
Coding in Progress.
Expand Down Expand Up @@ -2182,7 +2182,7 @@ <h5 class="fw-light pt-2 ms-2 text-teal"> <i class="fa-solid fa-house fa-sm"></i
<div>
<span class="h1" style="text-align: left; color:#59007f;" >
<span class="h1 federicka-huge" id="rt_var">
Religion Tolerance</span>
Religion Variables</span>
</span>
</div>
{% for key_top, values_top in all_rt_data.items %}
Expand Down
4 changes: 2 additions & 2 deletions seshat/apps/core/templates/core/polity/polity_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ <h6 class="text-secondary">* A polity is defined as an independent political uni
</tr>
<tr>
<td class="text-end pe-1" style="width:5%;">
<span type="button" tabindex="0" data-bs-toggle="popover" title="Religion Tolerance" data-bs-html="true" data-bs-trigger="focus">
<span type="button" tabindex="0" data-bs-toggle="popover" title="Religion Variables" data-bs-html="true" data-bs-trigger="focus">
<span class="badge px-2 py-2 custom-left-border-shadowed_4" style="background: #59007f;">RT</span>
</span>
</td>
Expand Down Expand Up @@ -422,7 +422,7 @@ <h2 class="text-teal pt-5"><i class="fa-solid fa-circle-chevron-right"></i> {{ a
</span>
{% endif %}
{% if a_polity.has_g_sc_wf.rt %}
<span type="button" tabindex="0" data-bs-toggle="popover" title="Religion Tolerance" data-bs-html="true" data-bs-trigger="focus">
<span type="button" tabindex="0" data-bs-toggle="popover" title="Religion Variables" data-bs-html="true" data-bs-trigger="focus">
<a href="{% url 'polity-detail-main' a_polity.id %}#rt_var"><span class="badge p-1" style="background: #59007f;">RT</span></a>
</span>
{% endif %}
Expand Down
6 changes: 3 additions & 3 deletions seshat/apps/core/tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ def test_assign_variables_to_shapes(self):
app_map = {
'sc': 'Social Complexity Variables',
'wf': 'Warfare Variables (Military Technologies)',
'rt': 'Religion Tolerance'
'rt': 'Religion Variables'
}
result_shapes, result_variables = assign_variables_to_shapes(shapes, app_map)
# Choose some example variables to test
Expand All @@ -597,11 +597,11 @@ def test_assign_variables_to_shapes(self):
}
expected_result_variables_gov_res_pub_pros = {
'formatted': 'Government Restrictions on Public Proselytizings',
'full_name': 'Government Restrictions: Government Restrictions on Public Proselytizings'
'full_name': 'Religious Tolerance: Government Restrictions on Public Proselytizings'
}
self.assertEqual(result_variables['Social Complexity Variables']['judge'], expected_result_variables_judge)
self.assertEqual(result_variables['Warfare Variables (Military Technologies)']['copper'], expected_result_variables_copper)
self.assertEqual(result_variables['Religion Tolerance']['gov_res_pub_pros'], expected_result_variables_gov_res_pub_pros)
self.assertEqual(result_variables['Religion Variables']['gov_res_pub_pros'], expected_result_variables_gov_res_pub_pros)

# Test that the shapes have been updated with the variables
self.assertEqual(result_shapes[0]['Judge'], 'present')
Expand Down
15 changes: 15 additions & 0 deletions seshat/apps/crisisdb/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -816,6 +816,21 @@ def show_nga(self):
return "NO_NGA_ASSOCIATED"
else:
return nga_rel.nga_party.name

def show_value_from(self):
if self.get_human_sacrifice_display():
return self.get_human_sacrifice_display()
else:
return None

def show_value_to(self):
return None

def subsection(self):
return "Human Sacrifice"

def sub_subsection(self):
return None

def get_absolute_url(self):
"""
Expand Down
2 changes: 1 addition & 1 deletion seshat/apps/crisisdb/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from seshat.apps.general.views import dynamic_create_view, dynamic_detail_view, generic_list_view, dynamic_update_view, dynamic_update_view_old, generic_metadata_download, generic_download

model_form_pairs_main = [
(Human_sacrifice, Human_sacrificeForm, 'human_sacrifice', 'human_sacrifice', 'Human Sacrifice', 'Religion and Normative Ideology', 'Human Sacrifice', 'crisisdb'),
(Human_sacrifice, Human_sacrificeForm, 'human_sacrifice', 'human_sacrifice', 'Human Sacrifice', 'Human Sacrifice', None, 'rt'),
(Power_transition, Power_transitionForm, 'power_transition', 'power_transition', 'Power Transition', 'Power Transitions', None, 'crisisdb'),
]

Expand Down
1 change: 1 addition & 0 deletions seshat/apps/crisisdb/var_defs.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
crisisdb_var_defs = {
'human_sacrifice': 'Human Sacrifice is the deliberate and ritualized killing of a person to please or placate supernatural entities (including gods, spirits, and ancestors) or gain other supernatural benefits.',
'power_transition': '''
We are interested in cataloguing the relative stability of past societies as proxied by the transition of power from one ruler to the next. In particular, we identify each transition of power (from named predecessor to named successor) and record whether it took place through normal succession mechanisms (whether legal/institutionalized means or customary/de facto procedures) or as the result of a conflict. We are seeking to record this information across the Seshat sample of polities, subject to availability of evidence. We are particularly interested in documenting the ebb and flow of stability in particular regions over time.<br><br>

Expand Down
6 changes: 3 additions & 3 deletions seshat/apps/general/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -7708,7 +7708,7 @@ def dynamic_create_view(request, form_class, x_name, coded_value, myvar, my_exp,
'sc': 'Social Complexity',
'wf': 'Warfare',
'ec': 'Economy',
'rt': 'Religion Tolerance',
'rt': 'Religion Variables',
'crisisdb': 'Crisisdb',
}

Expand Down Expand Up @@ -7904,7 +7904,7 @@ def dynamic_update_view_old(request, object_id, form_class, model_class, x_name,
'sc': 'Social Complexity',
'wf': 'Warfare',
'ec': 'Economy',
'rt': 'Religion Tolerance',
'rt': 'Religion Variables',
'crisisdb': 'Crisisdb',
}

Expand Down Expand Up @@ -8188,7 +8188,7 @@ def dynamic_update_view(request, object_id, form_class, model_class, x_name, cod
'sc': 'Social Complexity',
'wf': 'Warfare',
'ec': 'Economy',
'rt': 'Religion Tolerance',
'rt': 'Religion Variables',
'crisisdb': 'Crisisdb',
}

Expand Down
138 changes: 136 additions & 2 deletions seshat/apps/rt/forms.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from .models import Widespread_religion, Official_religion, Elites_religion, Theo_sync_dif_rel, Sync_rel_pra_ind_beli, Religious_fragmentation, Gov_vio_freq_rel_grp, Gov_res_pub_wor, Gov_res_pub_pros, Gov_res_conv, Gov_press_conv, Gov_res_prop_own_for_rel_grp, Tax_rel_adh_act_ins, Gov_obl_rel_grp_ofc_reco, Gov_res_cons_rel_buil, Gov_res_rel_edu, Gov_res_cir_rel_lit, Gov_dis_rel_grp_occ_fun, Soc_vio_freq_rel_grp, Soc_dis_rel_grp_occ_fun, Gov_press_conv_for_aga
from .models import Widespread_religion, Official_religion, Elites_religion, Theo_sync_dif_rel, Sync_rel_pra_ind_beli, Religious_fragmentation, Gov_vio_freq_rel_grp, Gov_res_pub_wor, Gov_res_pub_pros, Gov_res_conv, Gov_press_conv, Gov_res_prop_own_for_rel_grp, Tax_rel_adh_act_ins, Gov_obl_rel_grp_ofc_reco, Gov_res_cons_rel_buil, Gov_res_rel_edu, Gov_res_cir_rel_lit, Gov_dis_rel_grp_occ_fun, Soc_vio_freq_rel_grp, Soc_dis_rel_grp_occ_fun, Gov_press_conv_for_aga, Moralizing_supernatural_punishment_and_reward, Moralizing_supernatural_concern_is_primary, Moralizing_enforcement_is_certain, Moralizing_enforcement_is_broad, Moralizing_enforcement_is_targeted, Moralizing_enforcement_of_rulers, Moralizing_religion_adopted_by_elites, Moralizing_religion_adopted_by_commoners, Moralizing_enforcement_in_afterlife, Moralizing_enforcement_in_this_life, Moralizing_enforcement_is_agentic

from django import forms
from django.db.models.base import Model
Expand Down Expand Up @@ -417,4 +417,138 @@ class Meta:
labels = commonlabels
labels['coded_value'] = "&nbsp;<b> Societal Pressure To Convert Or Against Conversion: </b>"
widgets = dict(commonwidgets)
widgets['coded_value'] = forms.Select(attrs={'class': 'form-control mb-3', })
widgets['coded_value'] = forms.Select(attrs={'class': 'form-control mb-3', })


##### MSP Forms:

class Moralizing_supernatural_punishment_and_rewardForm(ExpertReviewedForm):
class Meta:
model = Moralizing_supernatural_punishment_and_reward
fields = commonfields.copy()
fields.append('coded_value')
labels = commonlabels
labels['coded_value'] = "&nbsp;<b> Moralizing Supernatural Punishment And Reward: </b>"
widgets = dict(commonwidgets)
widgets['coded_value'] = forms.Select(attrs={'class': 'form-control mb-3', })



class Moralizing_supernatural_concern_is_primaryForm(ExpertReviewedForm):
class Meta:
model = Moralizing_supernatural_concern_is_primary
fields = commonfields.copy()
fields.append('coded_value')
labels = commonlabels
labels['coded_value'] = "&nbsp;<b> Moralizing Supernatural Concern Is Primary: </b>"
widgets = dict(commonwidgets)
widgets['coded_value'] = forms.Select(attrs={'class': 'form-control mb-3', })



class Moralizing_enforcement_is_certainForm(ExpertReviewedForm):
class Meta:
model = Moralizing_enforcement_is_certain
fields = commonfields.copy()
fields.append('coded_value')
labels = commonlabels
labels['coded_value'] = "&nbsp;<b> Moralizing Enforcement Is Certain: </b>"
widgets = dict(commonwidgets)
widgets['coded_value'] = forms.Select(attrs={'class': 'form-control mb-3', })



class Moralizing_enforcement_is_broadForm(ExpertReviewedForm):
class Meta:
model = Moralizing_enforcement_is_broad
fields = commonfields.copy()
fields.append('coded_value')
labels = commonlabels
labels['coded_value'] = "&nbsp;<b> Moralizing Enforcement Is Broad: </b>"
widgets = dict(commonwidgets)
widgets['coded_value'] = forms.Select(attrs={'class': 'form-control mb-3', })



class Moralizing_enforcement_is_targetedForm(ExpertReviewedForm):
class Meta:
model = Moralizing_enforcement_is_targeted
fields = commonfields.copy()
fields.append('coded_value')
labels = commonlabels
labels['coded_value'] = "&nbsp;<b> Moralizing Enforcement Is Targeted: </b>"
widgets = dict(commonwidgets)
widgets['coded_value'] = forms.Select(attrs={'class': 'form-control mb-3', })



class Moralizing_enforcement_of_rulersForm(ExpertReviewedForm):
class Meta:
model = Moralizing_enforcement_of_rulers
fields = commonfields.copy()
fields.append('coded_value')
labels = commonlabels
labels['coded_value'] = "&nbsp;<b> Moralizing Enforcement Of Rulers: </b>"
widgets = dict(commonwidgets)
widgets['coded_value'] = forms.Select(attrs={'class': 'form-control mb-3', })



class Moralizing_religion_adopted_by_elitesForm(ExpertReviewedForm):
class Meta:
model = Moralizing_religion_adopted_by_elites
fields = commonfields.copy()
fields.append('coded_value')
labels = commonlabels
labels['coded_value'] = "&nbsp;<b> Moralizing Religion Adopted By Elites: </b>"
widgets = dict(commonwidgets)
widgets['coded_value'] = forms.Select(attrs={'class': 'form-control mb-3', })



class Moralizing_religion_adopted_by_commonersForm(ExpertReviewedForm):
class Meta:
model = Moralizing_religion_adopted_by_commoners
fields = commonfields.copy()
fields.append('coded_value')
labels = commonlabels
labels['coded_value'] = "&nbsp;<b> Moralizing Religion Adopted By Commoners: </b>"
widgets = dict(commonwidgets)
widgets['coded_value'] = forms.Select(attrs={'class': 'form-control mb-3', })



class Moralizing_enforcement_in_afterlifeForm(ExpertReviewedForm):
class Meta:
model = Moralizing_enforcement_in_afterlife
fields = commonfields.copy()
fields.append('coded_value')
labels = commonlabels
labels['coded_value'] = "&nbsp;<b> Moralizing Enforcement In Afterlife: </b>"
widgets = dict(commonwidgets)
widgets['coded_value'] = forms.Select(attrs={'class': 'form-control mb-3', })



class Moralizing_enforcement_in_this_lifeForm(ExpertReviewedForm):
class Meta:
model = Moralizing_enforcement_in_this_life
fields = commonfields.copy()
fields.append('coded_value')
labels = commonlabels
labels['coded_value'] = "&nbsp;<b> Moralizing Enforcement In This Life: </b>"
widgets = dict(commonwidgets)
widgets['coded_value'] = forms.Select(attrs={'class': 'form-control mb-3', })



class Moralizing_enforcement_is_agenticForm(ExpertReviewedForm):
class Meta:
model = Moralizing_enforcement_is_agentic
fields = commonfields.copy()
fields.append('coded_value')
labels = commonlabels
labels['coded_value'] = "&nbsp;<b> Moralizing Enforcement Is Agentic: </b>"
widgets = dict(commonwidgets)
widgets['coded_value'] = forms.Select(attrs={'class': 'form-control mb-3', })

Loading
Loading