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 | .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 | 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 | 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 | mac, or a system without python3, this can be difficult. | ||||||
| case, the ``makemigrations.sh`` script takes advantaged of a docker | 
 | ||||||
| container that's slightly modified, and runs the makemigration action | In such a case, you can use the above script to make and run a dev | ||||||
| on the files in your working directory. | container; then:: | ||||||
|  |     docker exec -it symposion ./manage.py makemigrations | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| Running a dev instance in a VirtualEnv | 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 \ | RUN set -ex \ | ||||||
|     && apt-get update |     && apt-get update | ||||||
|  | @ -41,4 +40,10 @@ RUN set -x \ | ||||||
|     && DJANGO_SECRET_KEY=1234 STRIPE_PUBLIC_KEY=1234 STRIPE_SECRET_KEY=1234 \ |     && DJANGO_SECRET_KEY=1234 STRIPE_PUBLIC_KEY=1234 STRIPE_SECRET_KEY=1234 \ | ||||||
|        DATABASE_URL="sqlite:////dev/null" \ |        DATABASE_URL="sqlite:////dev/null" \ | ||||||
|        python manage.py collectstatic --noinput -l -v 0 |        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"] | 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 | GCS_BUCKET=5CEA51A5-A613-4AEF-A9FB-D0A57D77C13B | ||||||
| GOOGLE_APPLICATION_CREDENTIALS=/dev/null | GOOGLE_APPLICATION_CREDENTIALS=/dev/null | ||||||
| DATABASE_URL=sqlite:////tmp/symposion.sqlite | 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} | 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 stop symposion | ||||||
| docker container rm 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 container start symposion | ||||||
| docker exec symposion ./manage.py migrate | docker exec symposion ./manage.py migrate | ||||||
| docker exec symposion ./manage.py loaddata ./fixtures/*.json | 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 %} |       {% include "_form_snippet.html" with form=form %} | ||||||
|       <br /> |       <br /> | ||||||
|       <div class="btn-group"> |       <div class="btn-group"> | ||||||
|         <input class="btn" type="submit" value="Save Profile" /> |           <input class="btn btn-success" type="submit" value="Save Profile" /> | ||||||
|         <a class="btn btn-primary" href="{% url "dashboard" %}">Return to dashboard</a> |           {% if user.attendee %} | ||||||
|  |           <a class="btn btn-info" href="{% url "dashboard" %}">Cancel</a> | ||||||
|  |           {% endif %} | ||||||
|       </div> |       </div> | ||||||
|     </fieldset> |     </fieldset> | ||||||
|   </form> |   </form> | ||||||
|  |  | ||||||
|  | @ -18,23 +18,52 @@ | ||||||
| <hr /> | <hr /> | ||||||
| 
 | 
 | ||||||
| {% for report in reports %} | {% for report in reports %} | ||||||
|   <h3>{{ report.title }}</h3> | <h3>{{ report.title }}</h3> | ||||||
|   <table class="table table-striped"> | <table class="table table-striped table-reportdata"> | ||||||
|     <tr> |     <thead> | ||||||
|       {% for heading in report.headings %} |         <tr> | ||||||
|         <th>{{ heading }}</th> |             {% for heading in report.headings %} | ||||||
|       {% endfor %} |             <th>{{ heading }}</th> | ||||||
|     </tr> |             {% endfor %} | ||||||
|     {% for line in report.rows %} |         </tr> | ||||||
|       <tr> |     </thead> | ||||||
|         {% for item in line %} |     <tbody> | ||||||
|           <td> |         {% for line in report.rows %} | ||||||
|             {{ item|safe }} |         <tr> | ||||||
|           </td> |             {% for item in line %} | ||||||
|  |             <td> | ||||||
|  |                 {{ item|safe }} | ||||||
|  |             </td> | ||||||
|  |             {% endfor %} | ||||||
|  |         </tr> | ||||||
|         {% endfor %} |         {% endfor %} | ||||||
|       </tr> |     </tbody> | ||||||
|     {% endfor %} | </table> | ||||||
|   </table> |  | ||||||
| {% endfor %} | {% endfor %} | ||||||
| 
 | 
 | ||||||
| {% endblock %} | {% 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>>", |                 "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", |                 "sPaginationType": "bootstrap", | ||||||
|                 "bStateSave": true, |                 "bStateSave": true, | ||||||
|  |                 "aLengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]], | ||||||
|                 "oTableTools": { |                 "oTableTools": { | ||||||
|                     "aButtons": [ |                     "aButtons": [ | ||||||
|                         "copy", |                         "copy", | ||||||
|  |  | ||||||
|  | @ -108,19 +108,19 @@ | ||||||
|     <script src="{{ STATIC_URL }}datatables/js/dataTables.bootstrap.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 src="//cdnjs.cloudflare.com/ajax/libs/ace/1.2.0/ace.js"></script> | ||||||
|     <script type="text/javascript"> |     <script type="text/javascript"> | ||||||
|         $(function() { |         $("table.table-reportdata").each(function () { | ||||||
|             $(".tip").tooltip(); |         $(this).dataTable({ | ||||||
|             $("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>>", | ||||||
|                 "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", |                 "sPaginationType": "bootstrap", | ||||||
|                 "bStateSave": true, |                 "bStateSave": true, | ||||||
|  |                 "aLengthMenu": [[10, 50, 100, -1], [10, 50, 100, "All"]], | ||||||
|                 "oTableTools": { |                 "oTableTools": { | ||||||
|                     "aButtons": [ |                 "aButtons": [ | ||||||
|                         "copy", |                 "copy", | ||||||
|                         "csv", |                 "csv", | ||||||
|                         "print" |                 "print" | ||||||
|                     ], |                 ], | ||||||
|                     "sSwfPath": "{{ STATIC_URL }}tabletools/swf/copy_csv_xls.swf" |                 "sSwfPath": "{{ STATIC_URL }}tabletools/swf/copy_csv_xls.swf" | ||||||
|                 } |                 } | ||||||
|             }); |             }); | ||||||
|         }); |         }); | ||||||
|  |  | ||||||
|  | @ -34,12 +34,15 @@ | ||||||
|         <h3 class="panel-title">{{ report.title }}</h3> |         <h3 class="panel-title">{{ report.title }}</h3> | ||||||
|       </div> |       </div> | ||||||
| 
 | 
 | ||||||
|       <table class="table table-striped"> |       <table class="table table-striped table-reportdata"> | ||||||
|  |         <thead> | ||||||
|         <tr> |         <tr> | ||||||
|           {% for heading in report.headings %} |           {% for heading in report.headings %} | ||||||
|             <th>{{ heading }}</th> |             <th>{{ heading }}</th> | ||||||
|           {% endfor %} |           {% endfor %} | ||||||
|         </tr> |         </tr> | ||||||
|  |         </thead> | ||||||
|  |         <tbody> | ||||||
|         {% for line in report.rows %} |         {% for line in report.rows %} | ||||||
|           <tr> |           <tr> | ||||||
|             {% for item in line %} |             {% for item in line %} | ||||||
|  | @ -48,7 +51,8 @@ | ||||||
|               </td> |               </td> | ||||||
|             {% endfor %} |             {% endfor %} | ||||||
|           </tr> |           </tr> | ||||||
|         {% endfor %} |           {% endfor %} | ||||||
|  |           </tbody> | ||||||
|       </table> |       </table> | ||||||
|     </div> |     </div> | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 James Polley
						James Polley