Permalink
Browse files

more changes for employer linking

  • Loading branch information...
1 parent d12489c commit 3de24d37eadd0b3241a4f1fa97f8b2cadb7b83c3 @edsu edsu committed Jul 7, 2012
Showing with 14 additions and 5 deletions.
  1. +1 −0 README.md
  2. +6 −0 jobs/models.py
  3. +1 −1 jobs/templates/job.html
  4. +1 −1 jobs/templates/jobs.html
  5. +2 −2 jobs/templates/reports.html
  6. +3 −1 jobs/views.py
View
1 README.md
@@ -55,6 +55,7 @@ queue. Here are some sites that might be useful to watch:
* [Canadian Libraries Association Jobs](http://www.cla.ca/AM/Template.cfm?Section=Job_Search&Template=/CM/HTMLDisplay.cfm&ContentID=1964)
* [Society of American Archivists](http://careers.archivists.org/)
* [libgig](http://publicboard.libgig.com/)
+* [DigitalKoans](http://digital-scholarship.org/digitalkoans/category/digital-library-jobs/) also on [Twitter](https://twitter.com/DigitalKoans)
License
-------
View
6 jobs/models.py
@@ -74,6 +74,9 @@ def __str__(self):
def get_absolute_url(self):
return ('job', [str(self.id)])
+ class Meta:
+ ordering = ['-post_date']
+
class JobEdit(models.Model):
user = models.ForeignKey(User, related_name="edits")
job = models.ForeignKey(Job, related_name="edits")
@@ -92,6 +95,9 @@ class Employer(models.Model, FreebaseEntity):
country = models.CharField(max_length=2)
domain = models.CharField(max_length=50)
+ def __str__(self):
+ return "%s - %s <%s>" % (self.name, self.slug, self.freebase_id)
+
class Keyword(models.Model):
created = models.DateTimeField(auto_now_add=True)
name = models.CharField(max_length=255)
View
2 jobs/templates/job.html
@@ -29,7 +29,7 @@
<dd itemprop="employmentType">{{ job.get_job_type_display }}</dd>
{% if job.employer %}
<dt>Employer:</dt>
- <dd itemprop="hiringOrganization"><a href="">{{ job.employer.name }}</a></dd>
+ <dd itemprop="hiringOrganization"><a href="{% url employer job.employer.slug %}">{{ job.employer.name }}</a></dd>
{% endif %}
{% if job.url %}
<dt>Job URL:</dt>
View
2 jobs/templates/jobs.html
@@ -42,7 +42,7 @@
{% for job in jobs %}
<tr>
<td>{{ job.post_date.date }}</td>
- <td><a href="{% url job job.id %}">{{ job.title }}</a> {% if job.employer %} at {{ job.employer.name }}{% endif %}</td>
+ <td><a href="{% url job job.id %}">{{ job.title }}</a> {% if job.employer %} at <a href="{% url employer job.employer.slug %}">{{ job.employer.name }}</a>{% endif %}</td>
<td>
<ul class="tags">
{% for subject in job.subjects.all %}
View
4 jobs/templates/reports.html
@@ -51,7 +51,7 @@
</tr>
{% for employer in employers_m.all %}
<tr>
- <td>{{ employer.name }}</td>
+ <td><a href="{% url employer employer.slug %}">{{ employer.name }}</a></td>
<td>{{ employer.num_jobs }}</td>
</tr>
{% endfor %}
@@ -67,7 +67,7 @@
</tr>
{% for employer in employers_y.all %}
<tr>
- <td>{{ employer.name }}</td>
+ <td><a href="{% url employer employer.slug %}">{{ employer.name }}</a></td>
<td>{{ employer.num_jobs }}</td>
</tr>
{% endfor %}
View
4 jobs/views.py
@@ -127,6 +127,8 @@ def _update_job(j, form, user):
# set employer
if form.get("employer", None):
+ employer_name = form.get("employer")
+ #employer_slug =
e, created = models.Employer.objects.get_or_create(
name=form.get("employer"),
freebase_id=form.get("employer_freebase_id"))
@@ -268,7 +270,7 @@ def employers(request):
return render(request, "employers.html", context)
def employer(request, employer_slug):
- employer = get_object_or_404(Employer, slug=employer_slug)
+ employer = get_object_or_404(models.Employer, slug=employer_slug)
return render(request, "employer.html", {"employer": employer})
def curate(request):

0 comments on commit 3de24d3

Please sign in to comment.