Supply a default value for target_audience for the ART+TECH miniconf
* The base model requires a value here * But we aren't using one; so there's none on the form * This change supplies a custom enumeration that's specific for this particular model, which has one value, which is a default value, which simply says that the field is N/A * This does mean that when viewing or reviewing the proposal one sees the Target Audience field, but it will say N/A. * Testing has shown that this does not affect the other types which descend from the base Proposal class; they still use the default enumeration.
This commit is contained in:
		
							parent
							
								
									c133f88832
								
							
						
					
					
						commit
						2af7eaea7f
					
				
					 3 changed files with 44 additions and 0 deletions
				
			
		|  | @ -0,0 +1,27 @@ | |||
| # -*- coding: utf-8 -*- | ||||
| # Generated by Django 1.11.5 on 2017-10-23 10:18 | ||||
| from __future__ import unicode_literals | ||||
| 
 | ||||
| from django.db import migrations, models | ||||
| 
 | ||||
| 
 | ||||
| class Migration(migrations.Migration): | ||||
| 
 | ||||
|     replaces = [('proposals', '0007_auto_20171023_2113'), ('proposals', '0008_auto_20171023_2114')] | ||||
| 
 | ||||
|     dependencies = [ | ||||
|         ('proposals', '0006_auto_20171015_1908_squashed_0007_auto_20171015_1918'), | ||||
|     ] | ||||
| 
 | ||||
|     operations = [ | ||||
|         migrations.AlterField( | ||||
|             model_name='arttechproposal', | ||||
|             name='target_audience', | ||||
|             field=models.IntegerField(choices=[(1, 'N/A')]), | ||||
|         ), | ||||
|         migrations.AlterField( | ||||
|             model_name='arttechproposal', | ||||
|             name='target_audience', | ||||
|             field=models.IntegerField(choices=[(1, 'N/A')], default=1), | ||||
|         ), | ||||
|     ] | ||||
|  | @ -190,6 +190,18 @@ class ArtTechProposal(Proposal): | |||
|         default="", | ||||
|     ) | ||||
| 
 | ||||
|     TARGET_NA = 1 | ||||
| 
 | ||||
|     TARGET_AUDIENCES = [ | ||||
|         (TARGET_NA, "N/A"), | ||||
|     ] | ||||
| 
 | ||||
|     target_audience = models.IntegerField(choices=TARGET_AUDIENCES, default=TARGET_NA) | ||||
| 
 | ||||
|     # def __init__(self, *args, **kwargs): | ||||
|     #     super(ArtTechProposal, self).__init__(*args, **kwargs) | ||||
|     #     self.target_audience = 3 | ||||
| 
 | ||||
|     class Meta: | ||||
|         verbose_name = "Art+Tech Miniconf Proposal" | ||||
| 
 | ||||
|  |  | |||
|  | @ -154,5 +154,10 @@ | |||
|         $(function() { | ||||
|             $("tr input.action-select").actions(); | ||||
|         }); | ||||
|         $('.dataTable').dataTable({ | ||||
|           "drawCallback": function( settings ) { | ||||
|             $("tr input.action-select").actions(); | ||||
|           } | ||||
|         }); | ||||
|     </script> | ||||
| {% endblock %} | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 James Polley
						James Polley