Merge branch 'ticket-testing' into 'master'
Add datatables to ticket reports See merge request LCA2018/symposion_app!55
This commit is contained in:
		
						commit
						84f198e0e3
					
				
					 12 changed files with 84 additions and 69 deletions
				
			
		|  | @ -1,2 +1,3 @@ | |||
| .git | ||||
| ve | ||||
| symposion-fixtures | ||||
| 
 | ||||
|  |  | |||
|  | @ -64,10 +64,11 @@ Making migrations | |||
| 
 | ||||
| If you make changes to the data model, you'll need to run "manage.py | ||||
| makemigrations" to create a matching migration file. If you're on a | ||||
| mac, or a system without python3, this can be difficult. In such a | ||||
| case, the ``makemigrations.sh`` script takes advantaged of a docker | ||||
| container that's slightly modified, and runs the makemigration action | ||||
| on the files in your working directory. | ||||
| mac, or a system without python3, this can be difficult. | ||||
| 
 | ||||
| In such a case, you can use the above script to make and run a dev | ||||
| container; then:: | ||||
|     docker exec -it symposion ./manage.py makemigrations | ||||
| 
 | ||||
| 
 | ||||
| Running a dev instance in a VirtualEnv | ||||
|  |  | |||
|  | @ -1,5 +1,4 @@ | |||
| FROM python:3.6 | ||||
| 
 | ||||
| FROM python:3.6 as symposion_base | ||||
| 
 | ||||
| RUN set -ex \ | ||||
|     && apt-get update | ||||
|  | @ -41,4 +40,10 @@ RUN set -x \ | |||
|     && DJANGO_SECRET_KEY=1234 STRIPE_PUBLIC_KEY=1234 STRIPE_SECRET_KEY=1234 \ | ||||
|        DATABASE_URL="sqlite:////dev/null" \ | ||||
|        python manage.py collectstatic --noinput -l -v 0 | ||||
| 
 | ||||
| FROM symposion_base as symposion_dev | ||||
| VOLUME /app/symposion_app | ||||
| CMD ["./manage.py", "runserver", "-v3", "0.0.0.0:8000"] | ||||
| 
 | ||||
| FROM symposion_base as symposion_prod | ||||
| CMD ["/usr/local/bin/uwsgi", "--http-socket", "0.0.0.0:8000", "--wsgi-file", "pinaxcon/wsgi.py"] | ||||
|  |  | |||
|  | @ -1,25 +0,0 @@ | |||
| FROM python:3.6 | ||||
| VOLUME /source | ||||
| COPY constraints.txt requirements.txt /setup/ | ||||
| RUN set -ex \ | ||||
|     && buildDeps=' \ | ||||
|         libmysqlclient-dev \ | ||||
|         libffi-dev \ | ||||
|         libfreetype6-dev \ | ||||
|         libjpeg-dev \ | ||||
|         libwebp-dev \ | ||||
|         libpng-dev \ | ||||
|         liblcms2-dev \ | ||||
|         zlib1g-dev \ | ||||
|         libmemcached-dev \ | ||||
|         libsasl2-dev \ | ||||
|     ' \ | ||||
|     && apt-get update \ | ||||
|     && apt-get install -y git xmlsec1 libmysqlclient18 \ | ||||
|     && apt-get install -y $buildDeps --no-install-recommends | ||||
| RUN pip install -c /setup/constraints.txt -r /setup/requirements.txt | ||||
| COPY . /source | ||||
| WORKDIR /source | ||||
| RUN pip install -c /setup/constraints.txt -r /source/vendored_requirements.txt | ||||
| ENTRYPOINT ["python","/source/manage.py", "makemigrations"] | ||||
| 
 | ||||
|  | @ -4,4 +4,5 @@ STRIPE_SECRET_KEY=5CEA51A5-A613-4AEF-A9FB-D0A57D77C13B | |||
| GCS_BUCKET=5CEA51A5-A613-4AEF-A9FB-D0A57D77C13B | ||||
| GOOGLE_APPLICATION_CREDENTIALS=/dev/null | ||||
| DATABASE_URL=sqlite:////tmp/symposion.sqlite | ||||
| SYMPOSION_DEV_MODE=LAPTOP | ||||
| SYMPOSION_DEV_MODE=LAPTOP | ||||
| SYMPOSION_APP_DEBUG=1 | ||||
|  | @ -2,10 +2,10 @@ | |||
| 
 | ||||
| CONTAINER_NAME=${1:-symposion_app} | ||||
| 
 | ||||
| docker image build -f docker/Dockerfile -t ${CONTAINER_NAME} . | ||||
| docker image build -f docker/Dockerfile -t ${CONTAINER_NAME} --target symposion_dev . | ||||
| docker container stop symposion | ||||
| docker container rm symposion | ||||
| docker container create --env-file docker/laptop-mode-env -p 28000:8000 --name symposion ${CONTAINER_NAME} | ||||
| docker container create --env-file docker/laptop-mode-env -p 28000:8000 -v $(pwd):/app/symposion_app --name symposion ${CONTAINER_NAME} | ||||
| docker container start symposion | ||||
| docker exec symposion ./manage.py migrate | ||||
| docker exec symposion ./manage.py loaddata ./fixtures/*.json | ||||
|  |  | |||
|  | @ -1,4 +0,0 @@ | |||
| #!/bin/bash -x | ||||
| docker image build -f docker/Dockerfile.makemigrations -t makemigrations . | ||||
| docker run -it --env-file=docker/laptop-mode-env -v $(pwd):/source makemigrations $* | ||||
| 
 | ||||
|  | @ -34,8 +34,10 @@ THIS IS THE FORM | |||
|       {% include "_form_snippet.html" with form=form %} | ||||
|       <br /> | ||||
|       <div class="btn-group"> | ||||
|         <input class="btn" type="submit" value="Save Profile" /> | ||||
|         <a class="btn btn-primary" href="{% url "dashboard" %}">Return to dashboard</a> | ||||
|           <input class="btn btn-success" type="submit" value="Save Profile" /> | ||||
|           {% if user.attendee %} | ||||
|           <a class="btn btn-info" href="{% url "dashboard" %}">Cancel</a> | ||||
|           {% endif %} | ||||
|       </div> | ||||
|     </fieldset> | ||||
|   </form> | ||||
|  |  | |||
|  | @ -18,23 +18,52 @@ | |||
| <hr /> | ||||
| 
 | ||||
| {% for report in reports %} | ||||
|   <h3>{{ report.title }}</h3> | ||||
|   <table class="table table-striped"> | ||||
|     <tr> | ||||
|       {% for heading in report.headings %} | ||||
|         <th>{{ heading }}</th> | ||||
|       {% endfor %} | ||||
|     </tr> | ||||
|     {% for line in report.rows %} | ||||
|       <tr> | ||||
|         {% for item in line %} | ||||
|           <td> | ||||
|             {{ item|safe }} | ||||
|           </td> | ||||
| <h3>{{ report.title }}</h3> | ||||
| <table class="table table-striped table-reportdata"> | ||||
|     <thead> | ||||
|         <tr> | ||||
|             {% for heading in report.headings %} | ||||
|             <th>{{ heading }}</th> | ||||
|             {% endfor %} | ||||
|         </tr> | ||||
|     </thead> | ||||
|     <tbody> | ||||
|         {% for line in report.rows %} | ||||
|         <tr> | ||||
|             {% for item in line %} | ||||
|             <td> | ||||
|                 {{ item|safe }} | ||||
|             </td> | ||||
|             {% endfor %} | ||||
|         </tr> | ||||
|         {% endfor %} | ||||
|       </tr> | ||||
|     {% endfor %} | ||||
|   </table> | ||||
|     </tbody> | ||||
| </table> | ||||
| {% endfor %} | ||||
| 
 | ||||
| {% endblock %} | ||||
| 
 | ||||
| {% block extra_script %} | ||||
|     <script src="{{ STATIC_URL }}datatables/js/jquery.dataTables.min.js" type="text/javascript"></script> | ||||
|     <script src="{{ STATIC_URL }}tabletools/js/TableTools.min.js" type="text/javascript"></script> | ||||
|     <script src="{{ STATIC_URL }}datatables/js/dataTables.bootstrap.js" type="text/javascript"></script> | ||||
|     <script src="//cdnjs.cloudflare.com/ajax/libs/ace/1.2.0/ace.js"></script> | ||||
|     <script type="text/javascript"> | ||||
|         $(function() { | ||||
|         $("table.table-reportdata").dataTable({ | ||||
|             "sDom": "<'row'<'col-md-3'l><'col-md-3'T><'col-md-4'f>r>t<'row'<'col-md-3'i><'col-md-5'p>>", | ||||
|                 "sPaginationType": "bootstrap", | ||||
|                 "aLengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]], | ||||
|                 "bStateSave": true, | ||||
|                 "oTableTools": { | ||||
|                 "aButtons": [ | ||||
|                 "copy", | ||||
|                 "csv", | ||||
|                 "print" | ||||
|                 ], | ||||
|                 "sSwfPath": "{{ STATIC_URL }}tabletools/swf/copy_csv_xls.swf" | ||||
|                 } | ||||
|                 }); | ||||
|                 }); | ||||
|     </script> | ||||
| {% endblock %} | ||||
|  |  | |||
|  | @ -80,6 +80,7 @@ | |||
|                 "sDom": "<'row'<'col-md-3'l><'col-md-3'T><'col-md-4'f>r>t<'row'<'col-md-3'i><'col-md-5'p>>", | ||||
|                 "sPaginationType": "bootstrap", | ||||
|                 "bStateSave": true, | ||||
|                 "aLengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]], | ||||
|                 "oTableTools": { | ||||
|                     "aButtons": [ | ||||
|                         "copy", | ||||
|  |  | |||
|  | @ -108,19 +108,19 @@ | |||
|     <script src="{{ STATIC_URL }}datatables/js/dataTables.bootstrap.js" type="text/javascript"></script> | ||||
|     <script src="//cdnjs.cloudflare.com/ajax/libs/ace/1.2.0/ace.js"></script> | ||||
|     <script type="text/javascript"> | ||||
|         $(function() { | ||||
|             $(".tip").tooltip(); | ||||
|             $("table.table-reviews").dataTable({ | ||||
|                 "sDom": "<'row'<'col-md-3'l><'col-md-3'T><'col-md-4'f>r>t<'row'<'col-md-3'i><'col-md-5'p>>", | ||||
|         $("table.table-reportdata").each(function () { | ||||
|         $(this).dataTable({ | ||||
|         "sDom": "<'row'<'col-md-3'l><'col-md-3'T><'col-md-4'f>r>t<'row'<'col-md-3'i><'col-md-5'p>>", | ||||
|                 "sPaginationType": "bootstrap", | ||||
|                 "bStateSave": true, | ||||
|                 "aLengthMenu": [[10, 50, 100, -1], [10, 50, 100, "All"]], | ||||
|                 "oTableTools": { | ||||
|                     "aButtons": [ | ||||
|                         "copy", | ||||
|                         "csv", | ||||
|                         "print" | ||||
|                     ], | ||||
|                     "sSwfPath": "{{ STATIC_URL }}tabletools/swf/copy_csv_xls.swf" | ||||
|                 "aButtons": [ | ||||
|                 "copy", | ||||
|                 "csv", | ||||
|                 "print" | ||||
|                 ], | ||||
|                 "sSwfPath": "{{ STATIC_URL }}tabletools/swf/copy_csv_xls.swf" | ||||
|                 } | ||||
|             }); | ||||
|         }); | ||||
|  |  | |||
|  | @ -34,12 +34,15 @@ | |||
|         <h3 class="panel-title">{{ report.title }}</h3> | ||||
|       </div> | ||||
| 
 | ||||
|       <table class="table table-striped"> | ||||
|       <table class="table table-striped table-reportdata"> | ||||
|         <thead> | ||||
|         <tr> | ||||
|           {% for heading in report.headings %} | ||||
|             <th>{{ heading }}</th> | ||||
|           {% endfor %} | ||||
|         </tr> | ||||
|         </thead> | ||||
|         <tbody> | ||||
|         {% for line in report.rows %} | ||||
|           <tr> | ||||
|             {% for item in line %} | ||||
|  | @ -48,7 +51,8 @@ | |||
|               </td> | ||||
|             {% endfor %} | ||||
|           </tr> | ||||
|         {% endfor %} | ||||
|           {% endfor %} | ||||
|           </tbody> | ||||
|       </table> | ||||
|     </div> | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 James Polley
						James Polley