Skip to content

Commit

Permalink
Apunté /trabajo/ a la nueva app. (#575)
Browse files Browse the repository at this point in the history
* Apunté /trabajo/ a la nueva app.

* New formed url in tests.
  • Loading branch information
facundobatista authored Jun 10, 2023
1 parent 1cd467f commit 5e8dff2
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 67 deletions.
2 changes: 1 addition & 1 deletion community/templates/community/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ <h3 class="text-center"><a href="{{ PYAR_WIKI_URL }}/foro_y_redes">Foro y redes

<article class="col-sm-4">
<div class="img proyectos_comunidad"></div>
<h3 class="text-center"><a href="{% url 'jobs_list_all' %}">Bolsa de Trabajo</a></h3>
<h3 class="text-center"><a href="{% url 'joboffers:list' %}">Bolsa de Trabajo</a></h3>
<p class="text-center">Ofrece o busca empleos relacionados con Python.</p>
</article>

Expand Down
2 changes: 1 addition & 1 deletion community/templates/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
<a href="http://planeta.python.org.ar"><span class="pyar"></span>{% trans 'Planeta' %}</a>
</li>
<li>
<a href="{% url 'jobs_list_all' %}"><span class="jobs"></span>{% trans 'Trabajos' %}</a>
<a href="{% url 'joboffers:list' %}"><span class="jobs"></span>{% trans 'Trabajos' %}</a>
</li>
</ul>
</nav>
Expand Down
2 changes: 1 addition & 1 deletion joboffers/templates/joboffers/_tags.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% load i18n %}
{% for tag in object.tags.all %}
<span class="label label-primary" href="{% url 'jobs_list_all' %}?tag_{{ tag.slug }}=1" >{{ tag.name }}</span>
<span class="label label-primary" href="{% url 'joboffers:list' %}?tag_{{ tag.slug }}=1" >{{ tag.name }}</span>
{% endfor %}
2 changes: 1 addition & 1 deletion joboffers/tests/test_joboffer_validations.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def test_joboffer_creation_as_publisher_with_all_fields_ok(publisher_client, use

# Asserts redirection to the joboffer status page
assert response.status_code == 302
assert f"/trabajo-nueva/{joboffer.slug}/" == response.url
assert f"/trabajo/{joboffer.slug}/" == response.url

# Deactivated should be the first state
assert OfferState.DEACTIVATED == joboffer.state
Expand Down
70 changes: 35 additions & 35 deletions joboffers/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,26 @@
from pyarweb.tests.fixtures import create_user, create_logged_client # noqa

from ..constants import (
ANALYTICS_URL,
ANALYTICS_CSV_URL,
ADD_URL,
ADMIN_URL,
APPROVE_URL,
APPROVED_MAIL_SUBJECT,
DEACTIVATE_URL,
HISTORY_URL,
LIST_URL,
PUBLISHER_FAILED_ERROR,
REACTIVATE_URL,
REACTIVATED_MAIL_SUBJECT,
REJECT_URL,
REJECTED_MAIL_SUBJECT,
REQUEST_MODERATION_URL,
TRACK_CONTACT_INFO_URL,
TELEGRAM_APPROVED_MESSAGE,
TELEGRAM_MODERATION_MESSAGE,
TELEGRAM_REJECT_MESSAGE,
VIEW_URL
ANALYTICS_URL,
ANALYTICS_CSV_URL,
ADD_URL,
ADMIN_URL,
APPROVE_URL,
APPROVED_MAIL_SUBJECT,
DEACTIVATE_URL,
HISTORY_URL,
LIST_URL,
PUBLISHER_FAILED_ERROR,
REACTIVATE_URL,
REACTIVATED_MAIL_SUBJECT,
REJECT_URL,
REJECTED_MAIL_SUBJECT,
REQUEST_MODERATION_URL,
TRACK_CONTACT_INFO_URL,
TELEGRAM_APPROVED_MESSAGE,
TELEGRAM_MODERATION_MESSAGE,
TELEGRAM_REJECT_MESSAGE,
VIEW_URL
)
from ..models import EventType, JobOffer, JobOfferHistory, JobOfferAccessLog, OfferState
from ..publishers import Publisher
Expand Down Expand Up @@ -180,7 +180,7 @@ def test_joboffer_request_moderation_ok(publisher_client, user_company_profile,

# Asserts redirection to the joboffer status page
assert 302 == response.status_code
assert f"/trabajo-nueva/{joboffer.slug}/" == response.url
assert f"/trabajo/{joboffer.slug}/" == response.url

messages = get_plain_messages(response)
assert messages[0].startswith("Oferta enviada a moderación")
Expand All @@ -192,7 +192,7 @@ def test_joboffer_request_moderation_ok(publisher_client, user_company_profile,
assert len(telegram_history) == 1
sent_message = telegram_history[0]['text'][0]
assert sent_message.endswith(TELEGRAM_MODERATION_MESSAGE.format(
offer_url=joboffer.get_full_url()
offer_url=joboffer.get_full_url()
))


Expand All @@ -215,7 +215,7 @@ def test_joboffer_deactivate_ok(publisher_client, user_company_profile):

# Asserts redirection to the joboffer status page
assert 302 == response.status_code
assert f"/trabajo-nueva/{joboffer.slug}/" == response.url
assert f"/trabajo/{joboffer.slug}/" == response.url

messages = get_plain_messages(response)
assert messages[0].startswith("Oferta desactiva")
Expand Down Expand Up @@ -243,7 +243,7 @@ def test_joboffer_reactivate_ok(publisher_client, user_company_profile):

# Asserts redirection to the joboffer status page
assert 302 == response.status_code
assert f"/trabajo-nueva/{joboffer.slug}/" == response.url
assert f"/trabajo/{joboffer.slug}/" == response.url

messages = get_plain_messages(response)
assert messages[0].startswith("Oferta reactivada")
Expand Down Expand Up @@ -396,7 +396,7 @@ def test_joboffer_approve_ok(

# Asserts redirection to the joboffer status page
assert 302 == response.status_code
assert f"/trabajo-nueva/{joboffer.slug}/" == response.url
assert f"/trabajo/{joboffer.slug}/" == response.url

messages = get_plain_messages(response)
assert messages[0].startswith("Oferta aceptada y activada.")
Expand All @@ -412,8 +412,8 @@ def test_joboffer_approve_ok(
assert len(telegram_history) == 1
sent_message = telegram_history[0]['text'][0]
assert sent_message.endswith(TELEGRAM_APPROVED_MESSAGE.format(
offer_url=joboffer.get_full_url(),
username=admin_user.username
offer_url=joboffer.get_full_url(),
username=admin_user.username
))

assert publish_function.called
Expand Down Expand Up @@ -474,7 +474,7 @@ def test_joboffer_reject_ok(admin_client, admin_user, user_company_profile, tele

# Asserts redirection to the joboffer status page
assert 302 == response.status_code
assert f"/trabajo-nueva/{joboffer.slug}/" == response.url
assert f"/trabajo/{joboffer.slug}/" == response.url

messages = get_plain_messages(response)
assert messages[0].startswith("Oferta rechazada.")
Expand All @@ -489,9 +489,9 @@ def test_joboffer_reject_ok(admin_client, admin_user, user_company_profile, tele
assert len(telegram_history) == 1
sent_message = telegram_history[0]['text'][0]
assert sent_message.endswith(TELEGRAM_REJECT_MESSAGE.format(
offer_title=joboffer.title,
offer_url=joboffer.get_full_url(),
username=admin_user.username
offer_title=joboffer.title,
offer_url=joboffer.get_full_url(),
username=admin_user.username
))


Expand Down Expand Up @@ -1036,10 +1036,10 @@ def test_render_joboffers_analytics_and_counts_ok(
user = user_company_profile.user

joboffer, expected_total_job_views = create_analytics_sample_data(
test_username=user.username,
test_offer_title='Testing Offer 1',
test_company=company,
max_views_amount=10
test_username=user.username,
test_offer_title='Testing Offer 1',
test_company=company,
max_views_amount=10
)

target_url = reverse(ANALYTICS_URL, kwargs={'slug': joboffer.slug})
Expand Down
48 changes: 22 additions & 26 deletions joboffers/urls.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from django.urls import re_path
from .views import (
DownloadAnalyticsAsCsv, JobOfferAdminView, JobOfferAnalyticsView, JobOfferApproveView,
JobOfferCreateView, JobOfferDeactivateView, JobOfferDetailView, JobOfferHistoryView,
JobOfferListView, JobOfferUpdateView, JobOfferRejectView, JobOfferReactivateView,
JobOfferRequestModerationView, TrackContactInfoView, JobOffersFeed
DownloadAnalyticsAsCsv, JobOfferAdminView, JobOfferAnalyticsView, JobOfferApproveView,
JobOfferCreateView, JobOfferDeactivateView, JobOfferDetailView, JobOfferHistoryView,
JobOfferListView, JobOfferUpdateView, JobOfferRejectView, JobOfferReactivateView,
JobOfferRequestModerationView, TrackContactInfoView, JobOffersFeed
)


Expand All @@ -12,43 +12,39 @@
re_path(r'^admin/$', JobOfferAdminView.as_view(), name='admin'),
re_path(r'^nueva/$', JobOfferCreateView.as_view(), name='add'),
re_path(r'^rss/$', JobOffersFeed(), name='feed'),
re_path(r'^(?P<slug>[\w-]+)/rechazar/$', JobOfferRejectView.as_view(), name='reject'),
re_path(r'^(?P<slug>[\w-]+)/aceptar/$', JobOfferApproveView.as_view(), name='approve'),
re_path(
r'^(?P<slug>[\w-]+)/rechazar/$', JobOfferRejectView.as_view(), name='reject'
r'^(?P<slug>[\w-]+)/desactivar/$', JobOfferDeactivateView.as_view(),
name='deactivate'
),
re_path(
r'^(?P<slug>[\w-]+)/aceptar/$', JobOfferApproveView.as_view(), name='approve'
r'^(?P<slug>[\w-]+)/reactivar/$', JobOfferReactivateView.as_view(),
name='reactivate'
),
re_path(
r'^(?P<slug>[\w-]+)/desactivar/$', JobOfferDeactivateView.as_view(),
name='deactivate'
r'^(?P<slug>[\w-]+)/solicitar-moderacion/$', JobOfferRequestModerationView.as_view(),
name='request_moderation'
),
re_path(
r'^(?P<slug>[\w-]+)/reactivar/$', JobOfferReactivateView.as_view(),
name='reactivate'
),
re_path(
r'^(?P<slug>[\w-]+)/solicitar-moderacion/$', JobOfferRequestModerationView.as_view(),
name='request_moderation'
),
re_path(
r'^(?P<slug>[\w-]+)/historial/$', JobOfferHistoryView.as_view(),
name='history'
r'^(?P<slug>[\w-]+)/historial/$', JobOfferHistoryView.as_view(),
name='history'
),
re_path(r'^(?P<slug>[\w-]+)/$', JobOfferDetailView.as_view(), name='view'),
re_path(
r'^(?P<slug>[\w-]+)/editar$', JobOfferUpdateView.as_view(),
name='edit'
r'^(?P<slug>[\w-]+)/editar$', JobOfferUpdateView.as_view(),
name='edit'
),
re_path(
r'^(?P<slug>[\w-]+)/track-contact-info-view$', TrackContactInfoView.as_view(),
name='track-contact-info-view'
r'^(?P<slug>[\w-]+)/track-contact-info-view$', TrackContactInfoView.as_view(),
name='track-contact-info-view'
),
re_path(
r'^(?P<slug>[\w-]+)/analitica$', JobOfferAnalyticsView.as_view(),
name='analytics'
r'^(?P<slug>[\w-]+)/analitica$', JobOfferAnalyticsView.as_view(),
name='analytics'
),
re_path(
r'^(?P<slug>[\w-]+)/visitas.csv$', DownloadAnalyticsAsCsv.as_view(),
name='download-analytics-csv'
r'^(?P<slug>[\w-]+)/visitas.csv$', DownloadAnalyticsAsCsv.as_view(),
name='download-analytics-csv'
)
]
4 changes: 2 additions & 2 deletions pyarweb/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@
re_path(r'^empresas/', include(('pycompanies.urls', 'pycompanies'), namespace='companies')),
re_path(r'^taggit_autosuggest/', include('taggit_autosuggest.urls')),
re_path(r'^summernote/', include('django_summernote.urls')),
re_path(r'^trabajo/', include('jobs.urls')),
re_path(r'^trabajo-vieja/', include('jobs.urls')),
re_path(r'^admin/', admin.site.urls),
re_path(r'^accounts/', include('allauth.urls')),
re_path(r'^eventos/', include(('events.urls', 'events'), namespace='events')),
re_path(r'^captcha/', include('captcha.urls')),
re_path(r'^trabajo-nueva/', include(('joboffers.urls', 'joboffers'), namespace='joboffers')),
re_path(r'^trabajo/', include(('joboffers.urls', 'joboffers'), namespace='joboffers')),

# no puedo usar el static porque no funcia en produccion y en prod django esta
# sirviendo los archivos estaticos. Esto es sacado del codigo de la funcion.
Expand Down

0 comments on commit 5e8dff2

Please sign in to comment.