Skip to content

Commit

Permalink
switch to short urls in reverse(); switch to render(); re-enable all …
Browse files Browse the repository at this point in the history
…URLs
  • Loading branch information
dstndstn committed Jun 13, 2017
1 parent 27be9e3 commit 00e5253
Show file tree
Hide file tree
Showing 44 changed files with 223 additions and 238 deletions.
7 changes: 4 additions & 3 deletions net/find.py
Expand Up @@ -6,14 +6,15 @@
p = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(p)
import settings

import django
django.setup()

from astrometry.net.models import *
from astrometry.util.file import *
from astrometry.util.multiproc import *
from log import *

import django
django.setup()

from django.contrib.auth.models import User

import logging
Expand Down
8 changes: 4 additions & 4 deletions net/models.py
Expand Up @@ -989,7 +989,7 @@ def get_best_job(self):

def get_absolute_url(self):
kwargs = {'user_image_id':self.id}
abs_url = reverse('astrometry.net.views.image.user_image', kwargs=kwargs)
abs_url = reverse('user_image', kwargs=kwargs)
return abs_url

def is_calibrated(self):
Expand Down Expand Up @@ -1120,7 +1120,7 @@ def set_error_message(self, msg):

def get_absolute_url(self):
kwargs = {'subid':self.id}
abs_url = reverse('astrometry.net.views.submission.status', kwargs=kwargs)
abs_url = reverse('submission_status', kwargs=kwargs)
return abs_url

def get_user_image(self):
Expand Down Expand Up @@ -1191,7 +1191,7 @@ def save(self, *args, **kwargs):

def get_absolute_url(self):
kwargs = {'album_id':self.id}
abs_url = reverse('astrometry.net.views.album.album', kwargs=kwargs)
abs_url = reverse('album', kwargs=kwargs)
return abs_url

class Comment(models.Model):
Expand Down Expand Up @@ -1233,7 +1233,7 @@ def create_default_license(self):
)

def get_absolute_url(self):
return reverse('astrometry.net.views.user.public_profile', user_id=self.user.id)
return reverse('public_profile', user_id=self.user.id)

def save(self, *args, **kwargs):
# for sorting users, enforce capitalization of first letter
Expand Down
4 changes: 2 additions & 2 deletions net/process_submissions.py
Expand Up @@ -30,7 +30,6 @@
import django
django.setup()


try:
import pyfits
except ImportError:
Expand Down Expand Up @@ -76,11 +75,12 @@
from astrometry.net.models import *
from log import *

from django.utils.log import dictConfig
from django.db.models import Count
from django.db import DatabaseError
from django.db.models import Q

from logging.config import dictConfig

dictConfig(settings.LOGGING)


Expand Down
6 changes: 4 additions & 2 deletions net/settings_common.py
Expand Up @@ -6,6 +6,8 @@

ALLOWED_HOSTS = ['astro.cs.toronto.edu']

WCS2KML = '/usr/local/wcs2kml/bin/wcs2kml'

ENABLE_SOCIAL=False
ENABLE_SOCIAL2=False

Expand Down Expand Up @@ -87,7 +89,6 @@
SESSION_COOKIE_NAME = 'AstrometryTestSession'

DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = ()

MANAGERS = ADMINS
Expand Down Expand Up @@ -181,13 +182,14 @@
# Insert your TEMPLATE_CONTEXT_PROCESSORS here or use this
# list if you haven't customized them:
'django.contrib.auth.context_processors.auth',
'django.template.context_processors.request',
'django.template.context_processors.debug',
'django.template.context_processors.i18n',
'django.template.context_processors.media',
'django.template.context_processors.static',
'django.template.context_processors.tz',
'django.contrib.messages.context_processors.messages',

'astrometry.net.models.context_user_profile',
],
},
Expand Down
14 changes: 3 additions & 11 deletions net/settings_nova2.py
@@ -1,22 +1,14 @@
from __future__ import absolute_import
sitename = 'nova2'

from settings_common import *
from astrometry.net.settings_common import *

# from settings_social import *
# ENABLE_SOCIAL = True
# SOUTH_MIGRATION_MODULES.update(SOCIAL_MIGRATION)
# TEMPLATE_CONTEXT_PROCESSORS += SOCIAL_TEMPLATE_CONTEXT_PROCESSORS
# INSTALLED_APPS += SOCIAL_INSTALLED_APPS
# AUTHENTICATION_BACKENDS = SOCIAL_AUTH_BACKENDS + AUTHENTICATION_BACKENDS
WCS2KML = '/usr/local/wcs2kml-0.2.1/bin/wcs2kml'

from settings_social2 import *
from astrometry.net.settings_social2 import *
ENABLE_SOCIAL2 = True
# SOUTH_MIGRATION_MODULES.update(SOCIAL_MIGRATION)
#TEMPLATE_CONTEXT_PROCESSORS += SOCIAL_TEMPLATE_CONTEXT_PROCESSORS
INSTALLED_APPS += SOCIAL_INSTALLED_APPS
AUTHENTICATION_BACKENDS = SOCIAL_AUTH_BACKENDS + AUTHENTICATION_BACKENDS

TEMPLATES[0]['OPTIONS']['context_processors'].extend(SOCIAL_TEMPLATE_CONTEXT_PROCESSORS)

sitename = 'nova2'
Expand Down
2 changes: 1 addition & 1 deletion net/templates/admin.html
Expand Up @@ -11,7 +11,7 @@
<tr><th>pid</th><th>watchdog</th></tr>
{% for p in procsubs %}
<tr>
<td><a href="{% url astrometry.net.views.admin.procsub psid=p.id %}">{{ p.pid }}</a></td>
<td><a href="{% url 'procsub' psid=p.id %}">{{ p.pid }}</a></td>
<td>{{ p.watchdog }}</td>
</tr>
{% endfor %}
Expand Down
4 changes: 2 additions & 2 deletions net/templates/album/edit.html
Expand Up @@ -6,11 +6,11 @@

{% block title %}
{{block.super}} &gt;
<a href="{% url 'astrometry.net.views.album.edit' album_id=album.id %}">Edit</a>
<a href="{% url 'album_edit' album_id=album.id %}">Edit</a>
{% endblock %}

{% block content %}
<form method="post" action="{% url 'astrometry.net.views.album.edit' album_id=album.id %}">
<form method="post" action="{% url 'album_edit' album_id=album.id %}">
{% csrf_token %}
<table class="settings_table">
<tr>
Expand Down
4 changes: 2 additions & 2 deletions net/templates/album/view.html
Expand Up @@ -34,10 +34,10 @@

{% if user == album.user %}
<div>
<a href="{% url 'astrometry.net.views.album.edit' album_id=album.id %}">Edit Album</a> |
<a href="{% url 'album_edit' album_id=album.id %}">Edit Album</a> |
<a class="confirm"
title="Are you sure you want to delete this album? (The images in it will not be deleted.)"
href="{% url 'astrometry.net.views.album.delete' album_id=album.id %}?next={% url 'astrometry.net.views.user.dashboard_albums' %}">Delete Album</a>
href="{% url 'album_delete' album_id=album.id %}?next={% url 'dashboard_albums' %}">Delete Album</a>
<hr />
</div>
{%endif %}
Expand Down
2 changes: 1 addition & 1 deletion net/templates/comment/comment.html
Expand Up @@ -8,7 +8,7 @@
{% if comment.recipient.owner == request.user or comment.author == request.user %}
<br /><a class="comment_delete confirm"
title="Are you sure you want to delete this comment?"
href="{% url 'astrometry.net.views.comment.delete' comment_id=comment.id %}?next={{next}}">[delete]</a>
href="{% url 'comment_delete' comment_id=comment.id %}?next={{next}}">[delete]</a>
{% endif %}
</div>
<br />
Expand Down
2 changes: 1 addition & 1 deletion net/templates/comment/form.html
@@ -1,6 +1,6 @@
<div id="comment_form_block">
{% if user.is_authenticated %}
<form method="post" name="comment_form" action="{% url 'astrometry.net.views.comment.new' category=category recipient_id=recipient_id %}">
<form method="post" name="comment_form" action="{% url 'comment_new' category=category recipient_id=recipient_id %}">
{% csrf_token %}
<div>
{{ comment_form.text }}<br />
Expand Down
4 changes: 2 additions & 2 deletions net/templates/dashboard/albums.html
Expand Up @@ -7,11 +7,11 @@

{% block title %}
{{block.super}} &gt;
<a href="{% url 'astrometry.net.views.user.dashboard_albums' %}">My Albums</a>
<a href="{% url 'dashboard_albums' %}">My Albums</a>
{% endblock %}

{% block dashboard_content %}
<div><a href="{% url 'astrometry.net.views.user.dashboard_create_album' %}">Create New Album</a></div>
<div><a href="{% url 'dashboard_create_album' %}">Create New Album</a></div>
<hr />
{% include 'album/paginated_album_set.html' with album_page=album_page %}
{% endblock %}
6 changes: 3 additions & 3 deletions net/templates/dashboard/create_album.html
Expand Up @@ -6,10 +6,10 @@

{% block title %}
{{block.super}} &gt;
<a href="{% url 'astrometry.net.views.user.dashboard_create_album' %}">Create Album</a>
<a href="{% url 'dashboard_create_album' %}">Create Album</a>
{% endblock %}
{% block dashboard_content %}
<form method="post" action="{% url 'astrometry.net.views.album.new' %}">
<form method="post" action="{% url 'album_new' %}">
{% csrf_token %}
<table class="settings_table">
<tr>
Expand Down Expand Up @@ -51,7 +51,7 @@
<br />
<div style="text-align:center">
<input type="submit" value="Create Album" class="bigbutton" />
<a href="{% url 'astrometry.net.views.user.dashboard_albums' %}" style="margin-left:10px">Cancel</a>
<a href="{% url 'dashboard_albums' %}" style="margin-left:10px">Cancel</a>
</div>
</form>
{% endblock %}
2 changes: 1 addition & 1 deletion net/templates/dashboard/submissions.html
Expand Up @@ -21,7 +21,7 @@

{% block title %}
{{block.super}} &gt;
<a href="{% url 'astrometry.net.views.user.dashboard_submissions' %}">My Submissions</a>
<a href="{% url 'dashboard_submissions' %}">My Submissions</a>
{% endblock %}
{% block dashboard_content %}
{% include 'submission/paginated_list.html' with submission_page=submission_page %}
Expand Down
2 changes: 1 addition & 1 deletion net/templates/dashboard/user_images.html
Expand Up @@ -7,7 +7,7 @@

{% block title %}
{{block.super}} &gt;
<a href="{% url 'astrometry.net.views.user.dashboard_user_images' %}">My Images</a>
<a href="{% url 'dashboard_user_images' %}">My Images</a>
{% endblock %}

{% block dashboard_content %}
Expand Down
2 changes: 1 addition & 1 deletion net/templates/flag/form.html
@@ -1,6 +1,6 @@
{% if user.is_authenticated %}
<div id="flag_form_block">
<form method="post" name="flag_form" action="{% url 'astrometry.net.views.flag.update_flags' category=category recipient_id=recipient_id %}">
<form method="post" name="flag_form" action="{% url 'update_flags' category=category recipient_id=recipient_id %}">
{% csrf_token %}
<div>
{% include 'flag/chooser.html' with flags=flags selected_flags=selected_flags %}
Expand Down
2 changes: 1 addition & 1 deletion net/templates/license/form.html
@@ -1,7 +1,7 @@
<div id="license_form_block">
{% if user.is_authenticated %}
{% block form_tag %}
<form method="post" name="license_form" action="{% url 'astrometry.net.views.license.edit' licensable_type=licensable_type licensable_id=licensable_id %}">
<form method="post" name="license_form" action="{% url 'license_edit' licensable_type=licensable_type licensable_id=licensable_id %}">
{% endblock %}
{% csrf_token %}
<div>
Expand Down
2 changes: 1 addition & 1 deletion net/templates/menu.html
Expand Up @@ -15,7 +15,7 @@
<li>
<a href="{% url 'dashboard' %}">Dashboard</a>
<ul class="dropdown">
<li><a href="{% url 'user-profile' user_id=user.id %}">My Profile</a></li>
<li><a href="{% url 'user_profile' user_id=user.id %}">My Profile</a></li>
<li><a href="{% url 'dashboard_profile' %}">Edit Profile</a></li>
<li><a href="{% url 'dashboard_user_images' %}">My Images</a></li>
<li><a href="{% url 'dashboard_albums' %}">My Albums</a></li>
Expand Down
4 changes: 2 additions & 2 deletions net/templates/procsub.html
Expand Up @@ -28,7 +28,7 @@
<th>Success?</th></tr>
{% for sub in procsub.subs.all %}
<tr>
<td><a href="{% url 'astrometry.net.views.submission.status' subid=sub.submission.id %}">{{ sub.id }}</a></td>
<td><a href="{% url 'submission_status' subid=sub.submission.id %}">{{ sub.id }}</a></td>
<td>{{ sub.finished }}</td>
<td>{{ sub.get_start_time_string }}</td>
<td>{{ sub.get_end_time_string }}</td>
Expand All @@ -48,7 +48,7 @@
{% for job in procsub.jobs.all %}
<tr>
<td>{{ job.job.id }}</td>
<td><a href="{% url 'astrometry.net.views.submission.status' subid=job.job.user_image.submission.id %}">{{ job.job.user_image.submission.id }}</a>
<td><a href="{% url 'submission_status' subid=job.job.user_image.submission.id %}">{{ job.job.user_image.submission.id }}</a>
<td>{{ job.finished }}</td>
<td>{{ job.get_start_time_string }}</td>
<td>{{ job.get_end_time_string }}</td>
Expand Down
6 changes: 3 additions & 3 deletions net/templates/search/index.html
Expand Up @@ -30,15 +30,15 @@
{% endblock %}

{% block title %}
<a href="{% url 'astrometry.net.views.image.search' %}">Search</a>
<a href="{% url 'image_search' %}">Search</a>
{% endblock %}

{% block content %}
<div id="search_block">
<div id="search_menu">
<ul class="view_menu">
<li><a href="{% url 'astrometry.net.views.search.images' %}?query={{ request.GET.query }}">Images</a></li>
<li><a href="{% url 'astrometry.net.views.search.users' %}?query={{ request.GET.query }}">Users</a></li>
<li><a href="{% url 'search_images' %}?query={{ request.GET.query }}">Images</a></li>
<li><a href="{% url 'search_users' %}?query={{ request.GET.query }}">Users</a></li>
</ul>
</div>
<div id="search_settings">
Expand Down
4 changes: 2 additions & 2 deletions net/templates/submission/list.html
Expand Up @@ -3,14 +3,14 @@
<ul>
{% for sub in submissions %}
<li class="submission">
<a href="{% url 'sub-status' subid=sub.id %}">Submission {{ sub.id }}</a>
<a href="{% url 'submission_status' subid=sub.id %}">Submission {{ sub.id }}</a>
<span class="timestamp">({{sub.submitted_on|date:"Y-m-d H:i"}})</span>
<table class="submission_job_list">
{% for user_image in sub.user_images.all %}
{% for job in user_image.jobs.all %}
<tr>
<td class="image_id">
<a href="{% url 'astrometry.net.views.image.user_image' job.user_image.id %}">image <span class="image_id">{{user_image.id}}</span></a>
<a href="{% url 'user_image' job.user_image.id %}">image <span class="image_id">{{user_image.id}}</span></a>
</td>
<td class="job_id">job id <span class="job_id">{{ job.id }}</span></td>
<td class="job_status">{% include "job/status.html" with job=job %}</td>
Expand Down
8 changes: 4 additions & 4 deletions net/templates/submission/status.html
Expand Up @@ -183,12 +183,12 @@
{% for image in sub.user_images.all %}
<tr>
<td>
<a href="{% url 'user-image' image.id %}">
<a href="{% url 'user_image' image.id %}">
<img src="{% url 'serve_image' id=image.image.get_thumbnail.id %}" />
</a>
</td>
<td>
<a href="{% url 'user-image' image.id %}">Go to results page</a>
<a href="{% url 'user_image' image.id %}">Go to results page</a>
<br/>
{% for job in image.jobs.all %}
Job {{ job.id }}: {% include "job/status.html" with job=job %}<br />
Expand All @@ -203,10 +203,10 @@

<a href="" class="log_tail_link">Log file tail <span>[-]</span><br /></a>
<div class="log_tail">
<a href={% url 'astrometry.net.views.submission.job_log_file' jobid=job.id %}>(full)</a><br />
<a href={% url 'job_log_file' jobid=job.id %}>(full)</a><br />
<pre>{{ job.get_log_tail }}</pre>
</div>
<a href={% url 'astrometry.net.views.submission.job_log_file2' jobid=job.id %}>Log file 2</a>
<a href={% url 'job_log_file_2' jobid=job.id %}>Log file 2</a>

{% empty %}
Waiting for processing to start...
Expand Down
2 changes: 1 addition & 1 deletion net/templates/tag/form.html
@@ -1,6 +1,6 @@
{% if user == recipient_owner %}
<div id="tag_form_block">
<form method="post" name="tag_form" action="{% url 'astrometry.net.views.tag.new' category=category recipient_id=recipient_id %}">
<form method="post" name="tag_form" action="{% url 'tag_new' category=category recipient_id=recipient_id %}">
{% csrf_token %}
<div>
{{ tag_form.text }}<br />
Expand Down
2 changes: 1 addition & 1 deletion net/templates/tag/tag.html
Expand Up @@ -4,7 +4,7 @@
{% if user == tag.tagger or user == recipient_owner %}
<a class="tag_delete confirm"
title="Are you sure you want to delete this tag?"
href="{% url 'astrometry.net.views.tag.delete' category=category recipient_id=recipient_id tag_id=tag.pk %}{% if next %}?next={{next}}{% endif %}">[remove]</a>
href="{% url 'tag_delete' category=category recipient_id=recipient_id tag_id=tag.pk %}{% if next %}?next={{next}}{% endif %}">[remove]</a>
{% endif %}
{% endif %}
</li>
2 changes: 1 addition & 1 deletion net/templates/tag/user_image_tag_list.html
Expand Up @@ -4,7 +4,7 @@
{% if user == user_image_tag.tagger or user == tagged_object_owner %}
<a class="remove_tag confirm"
title="Are you sure you would like to delete this tag?"
href="{% url 'astrometry.net.views.tag.remove_userimagetag' user_image_id=user_image_id tag_id=user_image_tag.pk %}{% if next %}?next={{next}}{% endif %}">[remove]</a></li>
href="{% url 'remove_userimagetag' user_image_id=user_image_id tag_id=user_image_tag.pk %}{% if next %}?next={{next}}{% endif %}">[remove]</a></li>
{% endif %}
{% endfor %}
</ul>
2 changes: 1 addition & 1 deletion net/templates/user/albums.html
Expand Up @@ -7,7 +7,7 @@

{% block title %}
{{block.super}} &gt;
<a href="{% url 'astrometry.net.views.user.user_albums' user_id=display_user.id %}">Albums</a>
<a href="{% url 'user_albums' user_id=display_user.id %}">Albums</a>
{% endblock %}

{% block user_content %}
Expand Down
2 changes: 1 addition & 1 deletion net/templates/user/display_name.html
@@ -1,5 +1,5 @@
{% if user %}
<a href="{% url 'user-profile' user_id=user.id %}">
<a href="{% url 'user_profile' user_id=user.id %}">
<span class="display_name">{{user.get_profile.display_name}}</span>
<span class="user_id">({{user.id}})</span>
</a>
Expand Down
2 changes: 1 addition & 1 deletion net/templates/user/menu.html
@@ -1,5 +1,5 @@
<ul class="view_menu">
<li><a href="{% url 'user-profile' display_user.id %}">Profile</a></li>
<li><a href="{% url 'user_profile' display_user.id %}">Profile</a></li>
{% if display_user == user %}
<li><a href="{% url 'dashboard_profile' %}">Edit Profile</a></li>
{% endif %}
Expand Down

0 comments on commit 00e5253

Please sign in to comment.