diff --git a/python-in-edu/resources/choices.py b/python-in-edu/resources/choices.py index 2d05f14..c08439b 100644 --- a/python-in-edu/resources/choices.py +++ b/python-in-edu/resources/choices.py @@ -65,7 +65,23 @@ class PopulationChoices(models.TextChoices): NONE = 'NON', _('None') - +class UseTypeChoices(models.TextChoices): + OPEN_SOURCE_PROJECT = 'OSP', _('Open Source Project - accepts contributions') + OPEN_EDUCATION_RESOURCE = 'OER', _('Open Education Resource - ok to distribute and/or revise/remix') + FREE_RESOURCE = 'FRE', _('Free Resource - free to use') + FREEMIUM = 'IUM', _('Freemium - significant portion of resource free to use') + PAID = 'PAI', _('Paid - costs money to access this resource') + UNKOWN = 'UNK', _('Bleh') + +class PythonChoices(models.TextChoices): + PYTHON_SPECIFIC = 'PS', _('Python Specific - part or all of resource is Python specific') + LANGUAGE_AGNOSTIC = 'LA', _('Language Agnostic - can be used with any programming language') + UNKNOWN = 'UN',_('Unkown') + +class SignUpChoices(models.TextChoices): + CREATE_ACCOUNT = 'CA', _('Must create an account') + PROVIDE_EMAIL = 'PE', _('Must provide email address') + NO_REQUIREMENT = 'NR',_('No sign up requirement') diff --git a/python-in-edu/resources/migrations/0007_auto_20210511_1410.py b/python-in-edu/resources/migrations/0007_auto_20210511_1410.py new file mode 100644 index 0000000..e9fe71a --- /dev/null +++ b/python-in-edu/resources/migrations/0007_auto_20210511_1410.py @@ -0,0 +1,127 @@ +# Generated by Django 3.1.10 on 2021-05-11 14:10 + +from django.db import migrations, models +import multiselectfield.db.fields + + +class Migration(migrations.Migration): + + dependencies = [ + ('resources', '0006_resource_status'), + ] + + operations = [ + migrations.RemoveField( + model_name='resource', + name='author_bio', + ), + migrations.RemoveField( + model_name='resource', + name='organization', + ), + migrations.RemoveField( + model_name='resource', + name='requirements', + ), + migrations.RemoveField( + model_name='resource', + name='standards', + ), + migrations.RemoveField( + model_name='resource', + name='url', + ), + migrations.AddField( + model_name='resource', + name='python_related', + field=models.CharField(choices=[('PS', 'Python Specific - part or all of resource is Python specific'), ('LA', 'Language Agnostic - can be used with any programming language'), ('UN', 'Unkown')], default='UN', help_text='Select the option that best describes this resource.', max_length=2), + ), + migrations.AddField( + model_name='resource', + name='url1', + field=models.CharField(default='bleh', help_text='You must link at least one resource.', max_length=200), + preserve_default=False, + ), + migrations.AddField( + model_name='resource', + name='url2', + field=models.CharField(blank=True, help_text='Optional additional url related to the same resource', max_length=200, null=True), + ), + migrations.AddField( + model_name='resource', + name='url3', + field=models.CharField(blank=True, help_text='Optional additional url related to the same resource', max_length=200, null=True), + ), + migrations.AddField( + model_name='resource', + name='url_description1', + field=models.CharField(blank=True, help_text='Use this field, if you are including multiple urls', max_length=50, null=True), + ), + migrations.AddField( + model_name='resource', + name='url_description2', + field=models.CharField(blank=True, help_text='Use this field, if you are including multiple urls', max_length=50, null=True), + ), + migrations.AddField( + model_name='resource', + name='url_description3', + field=models.CharField(blank=True, help_text='Use this field, if you are including multiple urls', max_length=50, null=True), + ), + migrations.AddField( + model_name='resource', + name='use_type', + field=models.CharField(choices=[('OSP', 'Open Source Project - accepts contributions'), ('OER', 'Open Education Resource - ok to distribute and/or revise/remix'), ('FRE', 'Free Resource - free to use'), ('IUM', 'Freemium - significant portion of resource free to use'), ('PAI', 'Paid - costs money to access this resource'), ('UNK', 'Bleh')], default='UN', help_text='Select the use type that best describes this resource.', max_length=3), + ), + migrations.AlterField( + model_name='resource', + name='attribution', + field=models.CharField(default='bleh', help_text='What person or organization created this resource?', max_length=250), + preserve_default=False, + ), + migrations.AlterField( + model_name='resource', + name='audience', + field=multiselectfield.db.fields.MultiSelectField(choices=[('K12', 'K-12'), ('HIE', 'Higher Education'), ('PFT', 'Professional Training'), ('NSP', 'Not Specific'), ('OTH', 'Other')], help_text="Select 'not specific' for resources for any or all audiences.", max_length=3), + ), + migrations.AlterField( + model_name='resource', + name='contact', + field=models.CharField(blank=True, help_text='Not for display, What is the best way to reach you if we have questions about this submission?', max_length=250, null=True), + ), + migrations.AlterField( + model_name='resource', + name='description', + field=models.CharField(default='bleh', help_text='Add a description of this resource. (max 500 characters)', max_length=500), + preserve_default=False, + ), + migrations.AlterField( + model_name='resource', + name='devices', + field=multiselectfield.db.fields.MultiSelectField(choices=[('DOL', 'Desktop or Laptop Computer'), ('CON', 'Chromebook or Other Netbook'), ('IPD', 'iPad'), ('ATB', 'Android Tablet'), ('IPH', 'iPhone'), ('APH', 'Android Phone'), ('RSP', 'Raspberry Pi'), ('MCC', 'Microcontroller(s)'), ('OTH', 'Other')], help_text='Which devices are compatible with this resource', max_length=3), + ), + migrations.AlterField( + model_name='resource', + name='language', + field=models.CharField(blank=True, help_text='What language/s are the written materials available in?', max_length=50, null=True), + ), + migrations.AlterField( + model_name='resource', + name='license', + field=models.CharField(blank=True, help_text="What is the copyright license type? Type 'unknown' if the license type is not available.", max_length=200, null=True), + ), + migrations.AlterField( + model_name='resource', + name='requires_signup', + field=models.CharField(choices=[('CA', 'Must create an account'), ('PE', 'Must provide email address'), ('NR', 'No sign up requirement')], help_text='Are users required to create an account or provide their email address to access this resource?', max_length=3), + ), + migrations.AlterField( + model_name='resource', + name='resource_type', + field=multiselectfield.db.fields.MultiSelectField(choices=[('PA', 'Platform or App'), ('CU', 'Curriculum'), ('TC', 'Tutorial or Course'), ('BK', 'Book'), ('WE', 'Worked Example'), ('DC', 'Documentation'), ('OT', 'Other')], help_text='Select all that apply.', max_length=3), + ), + migrations.AlterField( + model_name='resource', + name='title', + field=models.CharField(help_text='What is the name of the resource', max_length=200), + ), + ] diff --git a/python-in-edu/resources/models.py b/python-in-edu/resources/models.py index 24359b9..c08eff0 100644 --- a/python-in-edu/resources/models.py +++ b/python-in-edu/resources/models.py @@ -36,30 +36,46 @@ def create_user_profile(sender, instance, created, **kwargs): # Resource Models +#class Link(models.Model): + + + class Resource(models.Model): + #Required and optional fields + url1 = models.CharField(max_length=200, help_text="You must link at least one resource.") + url_description1 = models.CharField(max_length=50, blank=True, null=True, help_text="Use this field, if you are including multiple urls") + # resource = models.ForeignKey('Resource', on_delete=models.CASCADE, related_name='links') + url2 = models.CharField(max_length=200, blank=True, null=True, help_text="Optional additional url related to the same resource") + url_description2 = models.CharField(max_length=50, blank=True, null=True, help_text="Use this field, if you are including multiple urls") + # resource = models.ForeignKey('Resource', on_delete=models.CASCADE, related_name='links') + url3 = models.CharField(max_length=200, blank=True, null=True, help_text="Optional additional url related to the same resource") + url_description3 = models.CharField(max_length=50, blank=True, null=True, help_text="Use this field, if you are including multiple urls") + # resource = models.ForeignKey('Resource', on_delete=models.CASCADE, related_name='links') # core fields - title = models.CharField(max_length=200) - url = models.CharField(max_length=200) + title = models.CharField(max_length=200, help_text="What is the name of the resource") submitter = models.ForeignKey(User, on_delete=models.CASCADE) # FIXME: probably want to orphan rather than delete status = models.CharField(max_length=3, choices=choices.ResourceStatusChoices.choices, default=choices.ResourceStatusChoices.PROPOSED) # required fields - requires_signup = models.BooleanField(default=False) - resource_type = models.CharField(max_length=2, choices=choices.ResourceTypeChoices.choices) - audience = models.CharField(max_length=3, choices=choices.AudienceChoices.choices) - devices = models.CharField(max_length=3, choices=choices.DeviceChoices.choices) - language = models.CharField(max_length=50) - requirements = models.CharField(max_length=200) - license = models.CharField(max_length=200) + requires_signup = models.CharField(max_length=3,choices=choices.SignUpChoices.choices, help_text="Are users required to create an account or provide their email address to access this resource?") + resource_type = MultiSelectField(max_length=30,choices=choices.ResourceTypeChoices.choices, help_text="Select all that apply.") + audience = MultiSelectField(max_length=30,choices=choices.AudienceChoices.choices, help_text="Select 'not specific' for resources for any or all audiences.") + devices = MultiSelectField(max_length=30,choices=choices.DeviceChoices.choices, help_text="Which devices are compatible with this resource") + description = models.CharField(max_length=500, help_text="Add a description of this resource. (max 500 characters)") + attribution = models.CharField(max_length=250, help_text="What person or organization created this resource?") + use_type = models.CharField(max_length=3, choices=choices.UseTypeChoices.choices, help_text="Select the use type that best describes this resource.", default=choices.PythonChoices.UNKNOWN) + python_related = models.CharField(max_length=2, choices=choices.PythonChoices.choices, help_text="Select the option that best describes this resource.", default=choices.PythonChoices.UNKNOWN) # optional fields - description = models.CharField(max_length=250, blank=True, null=True) - attribution = models.CharField(max_length=250, blank=True, null=True) - author_bio = models.CharField(max_length=250, blank=True, null=True) - organization = models.CharField(max_length=250, blank=True, null=True) - contact = models.CharField(max_length=250, blank=True, null=True) - standards = models.CharField(max_length=250, blank=True, null=True) + + #author_bio = models.CharField(max_length=250, blank=True, null=True) + #organization = models.CharField(max_length=250, blank=True, null=True) + contact = models.CharField(max_length=250, blank=True, null=True, help_text="Not for display, What is the best way to reach you if we have questions about this submission?") + #standards = models.CharField(max_length=250, blank=True, null=True) + language = models.CharField(max_length=50, blank=True, null=True, help_text="What language/s are the written materials available in?") + #requirements = models.CharField(max_length=200, blank=True, null=True) + license = models.CharField(max_length=200, blank=True, null=True, help_text="What is the copyright license type? Type 'unknown' if the license type is not available.") def __str__(self): return f"{self.title} (submitted by {self.submitter}) - {self.get_status_display()}" diff --git a/python-in-edu/resources/templates/resources/add_resource.html b/python-in-edu/resources/templates/resources/add_resource.html index a04dae3..2d3702e 100644 --- a/python-in-edu/resources/templates/resources/add_resource.html +++ b/python-in-edu/resources/templates/resources/add_resource.html @@ -12,14 +12,17 @@
Before we begin, please confirm that the resource you are submitting is - free to use, reproduce and modify, with or without attribution. You will + free to use, reproduce and/or modify, with or without attribution. You will have an opportunity to specify the license of the resource in just a moment. + + Nevermind, take me back to the resource list
@@ -42,7 +45,7 @@
Tell us about the resource
var optional_fields = document.getElementById('optional_fields'); var optional_fields_button = document.getElementById('optional_fields_button'); - console.log(optional_fields_button) + console.log(optional_fields_button) {% if form.errors %} diff --git a/python-in-edu/resources/templates/resources/field_include.html b/python-in-edu/resources/templates/resources/field_include.html index fae964b..d392e61 100644 --- a/python-in-edu/resources/templates/resources/field_include.html +++ b/python-in-edu/resources/templates/resources/field_include.html @@ -41,6 +41,7 @@ {% if field.field.widget.input_type == "checkbox" %} + {{ field.label_tag }} {{ field }} {% endif %} diff --git a/python-in-edu/resources/templates/resources/resource_detail.html b/python-in-edu/resources/templates/resources/resource_detail.html index 12747d3..ef0bdbd 100644 --- a/python-in-edu/resources/templates/resources/resource_detail.html +++ b/python-in-edu/resources/templates/resources/resource_detail.html @@ -25,16 +25,18 @@

{{ object.title }}

+

- submitted by - {{ object.submitter.username }} -

-

- get the resource +

get the resource

+ {% if object.url_description1 %}

{{ object.url_description1 }}

{% endif %} + {% if object.url2 %}

+ get the resource

{% endif %} + {% if object.url_description2 %}

{{ object.url_description2 }}

{% endif %} + {% if object.url3 %}

+ get the resource

{% endif %} + {% if object.url_description3 %}

{{ object.url_description3 }}

{% endif %}

- {% if request.user == object.submitter %} @@ -46,12 +48,13 @@

{{ object.title }}

- {% if object.description %}

Description: {{ object.description }}

{% endif %} - {% if object.attribution %}

Attribution: {{ object.attribution }}

{% endif %} - {% if object.author_bio %}

Author's Bio: {{ object.author_bio }}

{% endif %} - {% if object.organization %}

Contributing Organization: {{ object.organization }}

{% endif %} - {% if object.contact %}

Contact Info: {{ object.contact}}

{% endif %} - {% if object.standards %}

Standards and Certifications: {{ object.standards}}

{% endif %} +

Description: {{ object.description }}

+

Created By: {{ object.attribution }}

+ +

submitted by + {{ object.submitter.username }}

+

@@ -61,12 +64,13 @@

{{ object.title }}

    -
  • type of resource: {{ object.get_resource_type_display }}
  • -
  • requires signup? {{ object.requires_signup }}
  • -
  • audience: {{ object.get_audience_display }}
  • -
  • devices: {{ object.get_devices_display }}
  • -
  • language: {{ object.language }}
  • -
  • requirements: {{ object.requirements }}
  • +
  • Type of resource: {{ object.get_resource_type_display }}
  • +
  • Audience: {{ object.get_audience_display }}
  • +
  • Devices: {{ object.get_devices_display }}
  • +
  • Requires signup? {{ object.get_requires_signup_display }}
  • +
  • Allowed use: {{ object.get_use_type_display }}
  • +
  • Python specific? {{ object.get_python_related_display }}
  • + {% if object.language != None %}
  • Language(s) of written material: {{ object.language }}
  • {% endif %}
diff --git a/python-in-edu/resources/templates/resources/resource_form.html b/python-in-edu/resources/templates/resources/resource_form.html index d02cb01..f72ff52 100644 --- a/python-in-edu/resources/templates/resources/resource_form.html +++ b/python-in-edu/resources/templates/resources/resource_form.html @@ -8,22 +8,25 @@ {% for field in form %} {% if field.field.required %} {% include "resources/field_include.html" with field=field %} - {% endif %} + {% elif not field.field.required %} + {% include "resources/field_include.html" with field=field %} + {% endif %} + {% endfor %} - + - + - + \ No newline at end of file diff --git a/python-in-edu/resources/templates/resources/resource_list.html b/python-in-edu/resources/templates/resources/resource_list.html index 9974f38..d2e5f05 100644 --- a/python-in-edu/resources/templates/resources/resource_list.html +++ b/python-in-edu/resources/templates/resources/resource_list.html @@ -28,13 +28,14 @@

Resources

Submitter Author Description - Language Audience Resource Type Devices Requires Signup + Language + Use Type Requirements License Standards @@ -48,7 +49,8 @@

Resources

data-child-author='{{resource.author_bio}}' data-child-license='{{resource.license}}' data-child-standards='{{resource.standards}}' - data-child-description='{{resource.description}}'> + data-child-description='{{resource.description}}' + data-child-descriptoin='{{resource.use_type}}'> @@ -57,13 +59,15 @@

Resources

{{ resource.submitter }} {{ resource.author_bio|truncatechars:10 }}

{{ resource.description|truncatechars:30 }}

- {{ resource.language }} + {{ resource.get_audience_display }} {{ resource.get_resource_type_display }} {{ resource.get_devices_display }} {{ resource.requires_signup}} + {{ resource.language }} + {{ resource.use_type }} {{ resource.requirements }} {{ resource.license }} {{ resource.standards }} diff --git a/python-in-edu/resources/templates/resources/update_resource.html b/python-in-edu/resources/templates/resources/update_resource.html index fd80397..528a745 100644 --- a/python-in-edu/resources/templates/resources/update_resource.html +++ b/python-in-edu/resources/templates/resources/update_resource.html @@ -29,7 +29,7 @@
Update your resource
optional_fields.style.display = "block"; } - + {% endblock content %} \ No newline at end of file diff --git a/python-in-edu/resources/templates/text_includes/getting_started_intro_text.html b/python-in-edu/resources/templates/text_includes/getting_started_intro_text.html index c66288a..a1913bc 100644 --- a/python-in-edu/resources/templates/text_includes/getting_started_intro_text.html +++ b/python-in-edu/resources/templates/text_includes/getting_started_intro_text.html @@ -1,6 +1,7 @@

Check out our toolkits and guides. These resources are full of recommendations, tips, and curated resources put together by experienced Python educators.

-

What Works in Teaching Python Toolkit

+{% load static %} +

What Works in Teaching Python Toolkit

Evidence-based teaching strategies

Take Action Toolkit

Actions that support CS instruction at the primary and secondary levels

diff --git a/python-in-edu/resources/views.py b/python-in-edu/resources/views.py index 917d9df..d40bc36 100644 --- a/python-in-edu/resources/views.py +++ b/python-in-edu/resources/views.py @@ -40,10 +40,9 @@ def get_context_data(self, **kwargs): class ResourceCreateView(LoginRequiredMixin, generic.CreateView): model = Resource - fields = ['title', 'url', 'requires_signup', 'resource_type', 'audience', - 'devices', 'language', 'requirements', 'description', 'attribution', - 'author_bio', 'organization', 'contact', 'standards', 'license'] - template_name = "resources/add_resource.html" + fields = ['title', 'url1', 'url_description1', 'url2', 'url_description2', 'url3', 'url_description3', 'resource_type', 'audience', 'devices', 'requires_signup', 'use_type', 'python_related', + 'description', 'attribution', 'language', 'license', 'contact'] + template_name = 'resources/add_resource.html' def get_success_url(self, instance): return reverse('resource_detail', kwargs={'pk': instance.pk }) @@ -57,9 +56,8 @@ def form_valid(self, form): class ResourceUpdateView(LoginRequiredMixin, generic.UpdateView): model = Resource - fields = ['title', 'requires_signup', 'resource_type', 'audience', - 'devices', 'language', 'requirements', 'description', 'attribution', - 'author_bio', 'organization', 'contact', 'standards'] + fields = ['title', 'url1', 'url_description1', 'url2', 'url_description2', 'url3', 'url_description3', 'resource_type', 'audience', 'devices', 'requires_signup', 'use_type', 'python_related', + 'description', 'attribution', 'language', 'license', 'contact'] template_name = 'resources/update_resource.html' def get_success_url(self): diff --git a/python-in-edu/static_source/guides/what_works_toolkit.pdf b/python-in-edu/static_source/guides/what_works_toolkit.pdf new file mode 100644 index 0000000..5ea44ac Binary files /dev/null and b/python-in-edu/static_source/guides/what_works_toolkit.pdf differ