Skip to content

Commit

Permalink
epytext docstring format
Browse files Browse the repository at this point in the history
  • Loading branch information
d1ffuz0r committed Dec 14, 2011
1 parent 2239dda commit 50ed21c
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lulz/admin.py
Expand Up @@ -13,6 +13,12 @@ class AdminJobs(admin.ModelAdmin):
actions = ["publish", "unpublish"]

def publish(self, request, queryset):
"""
Show selected vacancies
@param request:
@param queryset: Selected vacancy
@return:
"""
public = queryset.update(published=True)
if public == 1:
message_bit = u"1 вакансия была опубликована"
Expand All @@ -22,6 +28,12 @@ def publish(self, request, queryset):
publish.short_description = u"Опубликовать выбраные Вакансии"

def unpublish(self, request, queryset):
"""
Hide selected vacancies
@param request:
@param queryset: Selected vacancy
@return:
"""
ubpub = queryset.update(published=False)
if ubpub == 1:
message_bit = u"1 вакансия был убрана"
Expand Down
9 changes: 9 additions & 0 deletions lulz/forms.py
Expand Up @@ -4,6 +4,9 @@


class AddJob(forms.ModelForm):
"""
Form for create vacancy
"""
class Meta:
model = Job
fields = ("name", "desc", "tags", "link", "category")
Expand All @@ -19,6 +22,9 @@ class Meta:


class AddComment(forms.ModelForm):
"""
Form to add a comment for of vacancy
"""
class Meta:
model = Comments
fields = ("text", "job")
Expand All @@ -29,6 +35,9 @@ class Meta:


class SearchForm(forms.Form):
"""
Search form
"""
query = forms.CharField(label=u'Ключевое слово')
cat = forms.IntegerField(
label=u'Категория',
Expand Down
40 changes: 40 additions & 0 deletions lulz/models.py
Expand Up @@ -3,6 +3,12 @@


class Image(models.Model):
"""
Image model
@param name: str
@param image: file object
"""
name = models.CharField(max_length=100,
verbose_name=u"Название")
image = models.ImageField(upload_to="backgrounds",
Expand All @@ -17,6 +23,12 @@ def __unicode__(self):


class Category(models.Model):
"""
Category
@param name: str
@param image: file object
"""
name = models.CharField(max_length=100,
blank=False,
verbose_name=u"Название")
Expand All @@ -33,6 +45,19 @@ def __unicode__(self):


class Job(models.Model):
"""
Job model
@param name: str
@param desc: str
@param tags: str
@param likes: int
@param link: url
@param published: boolean
@param date: datetime
@param category: foreignkey Category
@param comments: ManyToManyField Comments
"""
name = models.CharField(max_length=100,
verbose_name=u"Заголовок")
desc = models.TextField(max_length=1000,
Expand Down Expand Up @@ -62,6 +87,14 @@ def __unicode__(self):


class Comments(models.Model):
"""
Comments model
@param text: str
@param job: foreignkey Job
@param agent: str
@param ip: str
"""
text = models.CharField(max_length=200,
verbose_name=u"Текст комментария")
job = models.ForeignKey(Job,
Expand All @@ -79,6 +112,13 @@ def __unicode__(self):


class Likes(models.Model):
"""
Likes model
@param job: foreignkey Job
@param agent: str
@param ip: str
"""
CHOISES = (
("1", "+"),
("0", "-")
Expand Down
36 changes: 36 additions & 0 deletions lulz/views.py
Expand Up @@ -13,6 +13,12 @@

@render_to("jobs.html")
def home(request):
"""
Home page
@param request:
@return json:
"""
count = Job.objects.filter(published=True).count()
jobs = Job.objects.filter(published=True).order_by("-id").all()
categories = Category.objects.all()
Expand All @@ -27,6 +33,12 @@ def home(request):

@render_json
def fetch(request):
"""
Fetch vacanciec with catecory
@param request:
@return json:
"""
result = {"success": False, "jobs": []}

if request.POST and request.POST["cat"]:
Expand Down Expand Up @@ -57,6 +69,12 @@ def fetch(request):

@render_json
def addvacancy(request):
"""
Add vacancy
@param request:
@return json:
"""
result = {"success": False}
if request.POST:
form = AddJob(request.POST)
Expand All @@ -75,6 +93,12 @@ def addvacancy(request):

@render_json
def addcomment(request):
"""
Create comment for vacancy
@param request:
@return json:
"""
result = {"success": False}
if request.POST:
form = AddComment(request.POST)
Expand All @@ -97,6 +121,12 @@ def addcomment(request):

@render_json
def full(request):
"""
Get full description for vacancy
@param request:
@return json:
"""
result = {"success": False}
if request.POST:
job = Job.objects.filter(published=True).\
Expand Down Expand Up @@ -127,6 +157,12 @@ def full(request):

@render_json
def like(request):
"""
Like or Dislike vacancy
@param request:
@return json:
"""
result = {"success": False}

if request.POST:
Expand Down

0 comments on commit 50ed21c

Please sign in to comment.