forked from gregoryfryns/winrepo
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8ab095c
commit a39b327
Showing
20 changed files
with
543 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/usr/bin/env python | ||
import os | ||
import sys | ||
|
||
if __name__ == "__main__": | ||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "winrepo.settings") | ||
try: | ||
from django.core.management import execute_from_command_line | ||
except ImportError as exc: | ||
raise ImportError( | ||
"Couldn't import Django. Are you sure it's installed and " | ||
"available on your PYTHONPATH environment variable? Did you " | ||
"forget to activate a virtual environment?" | ||
) from exc | ||
execute_from_command_line(sys.argv) |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from django.contrib import admin | ||
|
||
# Register your models here. | ||
from .models import Profile, Recommendation | ||
|
||
admin.site.register(Profile) | ||
admin.site.register(Recommendation) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from django.apps import AppConfig | ||
|
||
|
||
class ViewlistConfig(AppConfig): | ||
name = 'viewlist' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# Generated by Django 2.0.2 on 2018-02-23 21:16 | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
import django.utils.timezone | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
initial = True | ||
|
||
dependencies = [ | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='Profile', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('name', models.CharField(max_length=100)), | ||
('email', models.EmailField(max_length=254, unique=True)), | ||
('webpage', models.URLField()), | ||
('institution', models.CharField(max_length=100)), | ||
('country', models.CharField(max_length=70)), | ||
('position', models.CharField(max_length=30)), | ||
('grad_date', models.DateField()), | ||
('brain_structure', models.CharField(max_length=30)), | ||
('modalities', models.CharField(max_length=50)), | ||
('methods', models.CharField(max_length=50)), | ||
('domain', models.CharField(max_length=30)), | ||
('keywords', models.CharField(max_length=250)), | ||
('publish_date', models.DateTimeField(default=django.utils.timezone.now)), | ||
('last_updated', models.DateTimeField(default=django.utils.timezone.now)), | ||
], | ||
), | ||
migrations.CreateModel( | ||
name='Recommendation', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('reviewer_name', models.CharField(max_length=100)), | ||
('reviewer_email', models.EmailField(max_length=254)), | ||
('reviewer_position', models.CharField(max_length=30)), | ||
('seen_at_conf', models.BooleanField()), | ||
('comment', models.CharField(max_length=500)), | ||
('publish_date', models.DateTimeField(default=django.utils.timezone.now)), | ||
('last_updated', models.DateTimeField(default=django.utils.timezone.now)), | ||
('profile', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='viewlist.Profile')), | ||
], | ||
), | ||
] |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
from django.db import models | ||
from django.utils import timezone | ||
|
||
class Profile(models.Model): | ||
name = models.CharField(max_length=100, blank=False) | ||
email = models.EmailField(unique=True) | ||
webpage = models.URLField() | ||
institution = models.CharField(max_length=100, blank=False) | ||
country = models.CharField(max_length=70, blank=False) | ||
position = models.CharField(max_length=30, blank=False) | ||
grad_date = models.DateField() | ||
brain_structure = models.CharField(max_length=30) | ||
modalities = models.CharField(max_length=50) | ||
methods = models.CharField(max_length=50) | ||
domain = models.CharField(max_length=30) | ||
keywords = models.CharField(max_length=250) | ||
publish_date = models.DateTimeField(default=timezone.now) | ||
last_updated = models.DateTimeField(default=timezone.now) | ||
|
||
def __str__(self): | ||
return ' - '.join([self.name, self.position, self.institution]) | ||
|
||
class Recommendation(models.Model): | ||
profile = models.ForeignKey(Profile, on_delete=models.CASCADE) | ||
reviewer_name = models.CharField(max_length=100, blank=False) | ||
reviewer_email = models.EmailField(blank=False) | ||
reviewer_position = models.CharField(max_length=30, blank=False) | ||
seen_at_conf = models.BooleanField() | ||
comment = models.CharField(max_length=500) | ||
publish_date = models.DateTimeField(default=timezone.now) | ||
last_updated = models.DateTimeField(default=timezone.now) | ||
|
||
def __str__(self): | ||
return "%s said '%s' to %s" % (self.reviewer_name, self.comment, self.profile.name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<h1>Add new profile</h1> | ||
|
||
{% if error_message %}<p><strong>{{ error_message }}</strong></p>{% endif %} | ||
|
||
<form action="{% url 'viewlist:create' %}" method="post"> | ||
{% csrf_token %} | ||
<input type="text" name="name" id="name" /> | ||
<label for="name">Full Name</label><br /> | ||
|
||
<input type="text" name="institution" id="institution" /> | ||
<label for="institution">Institution</label><br /> | ||
|
||
<!-- drop down? --> | ||
<input type="text" name="country" id="country" /> | ||
<label for="country">Country</label><br /> | ||
|
||
<input type="email" name="email" id="email" /> | ||
<label for="email">Email address</label><br /> | ||
|
||
<!-- radio buttons / other = free text --> | ||
<input type="text" name="position" id="position" /> | ||
<label for="position">Position</label><br /> | ||
|
||
<input type="url" name="webpage" id="webpage" /> | ||
<label for="webpage">Linked In or web page</label><br /> | ||
|
||
<!-- drop downs month + year --> | ||
<input type="text" name="grad_date" id="grad_date" /> | ||
<label for="grad_date">Year PhD was obtained</label><br /> | ||
|
||
<!-- check boxes --> | ||
<input type="text" name="brain_structure" id="brain_structure" /> | ||
<label for="brain_structure">Field of Research - Brain Structure</label><br /> | ||
|
||
<!-- check boxes --> | ||
<input type="text" name="modalities" id="modalities" /> | ||
<label for="modalities">Field of Research - Modalities</label><br /> | ||
|
||
<!-- check boxes --> | ||
<input type="text" name="methods" id="methods" /> | ||
<label for="methods">Field of Research - Methods</label><br /> | ||
|
||
<!-- check boxes --> | ||
<input type="text" name="domain" id="domain" /> | ||
<label for="domain">Field of Research - Domain</label><br /> | ||
|
||
<input type="text" name="keywords" id="keywords" /> | ||
<label for="keywords">Field of Research - Keywords</label><br /> | ||
|
||
|
||
<input type="submit" value="Submit" /> | ||
</form> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<h1>Detailed profile for: #{{ profile.id }}</h1> | ||
<a href="mailto: {{ profile.email }}">{{ profile.name }}</a> - {{ profile.position }} - {{ profile.country }} - {{ profile.institution }} | ||
<h2> Recommendations </h2> | ||
<ul> | ||
{% for recommendation in profile.recommendation_set.all %} | ||
<li>{{ recommendation }}</li> | ||
{% endfor %} | ||
</ul> | ||
|
||
<a href="{% url 'viewlist:edit' profile.id %}">Edit</a> | ||
<a href="{% url 'viewlist:recommend' profile.id %}">Write a recommendation</a> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<h1>Edit: {{ profile }}</h1> | ||
|
||
{% if error_message %}<p><strong>{{ error_message }}</strong></p>{% endif %} | ||
|
||
<form action="{% url 'viewlist:update' profile.id %}" method="post"> | ||
{% csrf_token %} | ||
|
||
<input type="text" name="name" id="name" value="{{ profile.name }}" /> | ||
<label for="name">Full Name</label><br /> | ||
|
||
<input type="text" name="institution" id="institution" value="{{ profile.institution }}" /> | ||
<label for="institution">Institution</label><br /> | ||
|
||
<!-- drop down? --> | ||
<input type="text" name="country" id="country" value="{{ profile.country }}" /> | ||
<label for="country">Country</label><br /> | ||
|
||
<input type="email" name="email" id="email" value="{{ profile.email }}" /> | ||
<label for="email">Email address</label><br /> | ||
|
||
<!-- radio buttons / other = free text --> | ||
<input type="text" name="position" id="position" value="{{ profile.position }}" /> | ||
<label for="position">Position</label><br /> | ||
|
||
<input type="url" name="webpage" id="webpage" value="{{ profile.webpage }}" /> | ||
<label for="webpage">Linked In or web page</label><br /> | ||
|
||
<!-- drop downs month + year --> | ||
<!-- <input type="date" name="grad_date" id="grad_date" value="{{ profile.grad_date }}" /> --> | ||
<!-- <label for="grad_date">Year PhD was obtained</label><br /> --> | ||
|
||
<!-- check boxes --> | ||
<input type="text" name="brain_structure" id="brain_structure" value="{{ profile.brain_structure }}" /> | ||
<label for="brain_structure">Field of Research - Brain Structure</label><br /> | ||
|
||
<!-- check boxes --> | ||
<input type="text" name="modalities" id="modalities" value="{{ profile.modalities }}" /> | ||
<label for="modalities">Field of Research - Modalities</label><br /> | ||
|
||
<!-- check boxes --> | ||
<input type="text" name="methods" id="methods" value="{{ profile.modalities }}" /> | ||
<label for="methods">Field of Research - Methods</label><br /> | ||
|
||
<!-- check boxes --> | ||
<input type="text" name="domain" id="domain" value="{{ profile.domain }}" /> | ||
<label for="domain">Field of Research - Domain</label><br /> | ||
|
||
<input type="text" name="keywords" id="keywords" value="{{ profile.keywords }}" /> | ||
<label for="keywords">Field of Research - Keywords</label><br /> | ||
|
||
|
||
<input type="submit" value="Submit" /> | ||
</form> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{% if profile_list %} | ||
<table><tbody> | ||
<tr> | ||
<th>Name</th> | ||
<th></th> | ||
<th>Institution/Company</th> | ||
<th>Country</th> | ||
<th>Position</th> | ||
<th>Field of Research</th> | ||
<th>Keywords</th> | ||
<th>Details</th> | ||
</tr> | ||
{% for profile in profile_list %} | ||
<tr> | ||
<td>{{ profile.name }}</td> | ||
<td> | ||
{% if profile.email %} | ||
<a href="mailto:{{ profile.email }}">Email</a> | ||
{% endif %} | ||
{% if profile.webpage %} | ||
<a href="{{ profile.webpage }}" target="_blank">Webpage</a> | ||
{% endif %} | ||
</td> | ||
<td>{{ profile.institution }}</td> | ||
<td>{{ profile.country }}</td> | ||
<td>{{ profile.position }}</td> | ||
<td> | ||
<dl> | ||
<dt>Brain Area</dt><dd>{{ profile.brain_structure }}</dd> | ||
<dt>Domain</dt><dd>{{ profile.domain }}</dd> | ||
<dt>Modalities</dt><dd>{{ profile.modalities }}</dd> | ||
<dt>Methods</dt><dd>{{ profile.methods }}</dd> | ||
</dl> | ||
</td> | ||
<td>{{ profile.keywords}}</td> | ||
<td><a href="{% url 'viewlist:detail' profile.id %}">More details</a></td> | ||
</tr> | ||
{% endfor %} | ||
</tbody><table> | ||
{% else %} | ||
<p>No profiles are available.</p> | ||
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<h1>Write recommendation for: {{ profile }}</h1> | ||
|
||
<form action="{% url 'viewlist:update' profile.id %}" method="post"> | ||
{% csrf_token %} | ||
<input type="text" name="name" id="name" /> | ||
<label for="name">Your Name</label><br /> | ||
|
||
<input type="email" name="email" id="email" /> | ||
<label for="email">Email address</label><br /> | ||
|
||
<!-- check box --> | ||
<input type="text" name="position" id="position" /> | ||
<label for="position">Position</label><br /> | ||
|
||
<input type="url" name="webpage" id="webpage" /> | ||
<label for="webpage">Linked In or web page</label><br /> | ||
|
||
<input type="submit" value="Submit" /> | ||
</form> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from django.test import TestCase | ||
|
||
# Create your tests here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from django.urls import path | ||
|
||
from . import views | ||
|
||
app_name = 'viewlist' | ||
urlpatterns = [ | ||
path('', views.IndexView.as_view(), name='index'), | ||
path('<int:pk>/', views.DetailView.as_view(), name='detail'), | ||
path('<int:pk>/edit', views.EditView.as_view(), name='edit'), | ||
path('<int:profile_id>/update', views.update_profile, name='update'), | ||
path('<int:profile_id>/recommend', views.recommend, name='recommend'), | ||
path('add', views.add_profile_form, name='add'), | ||
path('create', views.create_profile, name='create'), | ||
] |
Oops, something went wrong.