Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions core/admin.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
from django.contrib import admin

from models import Job, Category

class CategoryAdmin(admin.ModelAdmin):
prepopulated_fields = {"slug": ("name",)}

admin.site.register(Job)
admin.site.register(Category, CategoryAdmin)
7 changes: 7 additions & 0 deletions core/api.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from tastypie.resources import ModelResource
from core.models import Job

class JobResource(ModelResource):
class Meta:
queryset = Job.objects.all()
resource_name = "job"
1 change: 1 addition & 0 deletions core/forms.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Formularios
from django.conf import settings
from django import forms
from models import Job

Expand Down
29 changes: 10 additions & 19 deletions core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,14 @@
# -*- coding: utf-8 -*-

# Los modelos creados!
from django.template.defaultfilters import slugify

from __future__ import unicode_literals

from django.db import models
from django.template.defaultfilters import slugify
from django.utils.encoding import python_2_unicode_compatible

from tinymce.models import HTMLField

class Category(models.Model):
class Meta:
Expand All @@ -23,35 +28,21 @@ def __unicode__(self):
def get_absolute_url(self):
return ("category/%s" % self.slug)

@python_2_unicode_compatible
class Job(models.Model):
name = models.CharField(max_length=200, verbose_name="nombre del trabajo")
category = models.ForeignKey(Category, verbose_name="categoría")
place = models.CharField(max_length=200, verbose_name="lugar")
description = models.TextField(verbose_name="Perfil de puesto")
application = models.TextField(verbose_name="Como aplicar?")
description = HTMLField(verbose_name="Perfil de puesto")
application = HTMLField(verbose_name="Como aplicar?")
pub_date = models.DateTimeField(auto_now_add=True)
company_name = models.CharField(max_length=200, verbose_name="nombre de compañía")
url = models.URLField(blank=True, null=True)
email = models.EmailField()
logo = models.ImageField(upload_to="images/logos", blank=True, null=True)

def __unicode__(self):
def __str__(self):
return self.name

def get_absolute_url(self):
return ("/job/%i/" % self.id)


#class Company(models.Model):
# name = models.CharField(max_length=200, verbose_name="nombre de compañía")
# slug = models.SlugField(max_length=200)
# url = models.URLField()
# email = models.EmailField()
# logo = models.ImageField(upload_to="images/logos")

# def __unicode__(self):
# return self.name




3 changes: 3 additions & 0 deletions core/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@
<head>
<title>Emplea.do - {% block title %} {% endblock title %}</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="{% static "wysihtml5/css/stylesheet.css" %}" rel="stylesheet">

<link href="{% static "bs/css/bootstrap.min.css" %}" rel="stylesheet">
<link href="{% static "bs/css/bootstrap.theme.min.css" %}" rel="stylesheet">
{% block external %} {% endblock external %}

</head>
<body>
Expand Down
13 changes: 12 additions & 1 deletion core/templates/jobs/job_form.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{% extends "base.html"%}
{% block title %} {% endblock title %}
{% block title %} Nuevo Trabajo {% endblock title %}



{% block content %}
<form method="post" action=".">{% csrf_token %}
{% for field in form %}
Expand All @@ -10,5 +13,13 @@
{% endfor %}
<button type="submit" class="btn">Sube tu Oferta</button>
</form>
<script type="text/javascript" src="/static/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript">
tinyMCE.init({
// General options
mode : "textareas",
theme : "simple",
});
</script>
{% endblock content %}

12 changes: 9 additions & 3 deletions emplea_do/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'tinymce',
'core',
'tastypie',
)

MIDDLEWARE_CLASSES = (
Expand Down Expand Up @@ -79,8 +81,12 @@

# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.6/howto/static-files/
STATICFILES_DIRS = (
os.path.join(BASE_DIR, "static"),
)
STATIC_ROOT = os.path.join(BASE_DIR, "static")


STATIC_URL = '/static/'

#STATICFILES_DIRS = (
# os.path.join(BASE_DIR, "static"),
#)

7 changes: 7 additions & 0 deletions emplea_do/urls.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
from django.conf.urls import patterns, include, url

from django.contrib import admin
from tastypie.api import Api
from core.views import JobList, JobDetail, JobCreate
from core.api import JobResource

v1_api = Api(api_name='v1')
v1_api.register(JobResource())

admin.autodiscover()

Expand All @@ -13,4 +18,6 @@
url(r'^job/new/$', JobCreate.as_view()),
url(r'^job/(?P<pk>\d+)/$', JobDetail.as_view()),
url(r'^admin/', include(admin.site.urls)),
url(r'^tinymce/', include('tinymce.urls')),
url(r'^api/', include(v1_api.urls)),
)
12 changes: 12 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,16 @@ Django==1.6.5
Pillow==2.4.0
argparse==1.2.1
distribute==0.6.24
dj-database-url==0.3.0
dj-static==0.0.5
django-tastypie==0.11.1
django-tinymce==1.5.2
django-toolbelt==0.0.1
gunicorn==18.0
psycopg2==2.5.3
pystache==0.5.4
python-dateutil==2.2
python-mimeparse==0.1.4
six==1.7.2
static==1.0.2
wsgiref==0.1.2