Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

create a post dfr #10

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
37 changes: 32 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,35 @@

### Eksikler

- [ ] Firmaların ilanları eklenecek
- [ ] Etiketlerin ilanları eklenecek
- [ ] Ilan gönderme eklenecek
- [ ] Lokasyona göre ilan arama eklenecek
- [ ] Search eklenecek (Pozisyon adı, şehir, type/örn: tam zamanlı)
- [X] Firmaların ilanları eklenecek
- [X] Etiketlerin ilanları eklenecek
- [X] Ilan gönderme eklenecek
- [X] Lokasyona göre ilan arama eklenecek
- [X] Search eklenecek (Pozisyon adı, şehir, type/örn: tam zamanlı)

### Gereksinimler

- postgresql
- python 3.6+

### Kurulum

paketlerin yüklenilmesi
```console
$ pip install -r requirements.txt
```

migration oluşturma
```console
$ python manage.py makemigrations
```

migrate
```console
$ python manage.py migrate
```

superuser oluşturma
```console
$ python manage.py createsuperuser
```
5 changes: 2 additions & 3 deletions kodilan/mail.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ def do_mail(email, title, theme, variables):
pass


# todo: create post will update
def send_activation(email, first_name, last_name, token):
def send_activation(email, company, token):
do_mail(email, "İlan Onay", "activation",
{'first_name': first_name, 'last_name': last_name, 'code': token})
{'company': company, 'code': token})
29 changes: 25 additions & 4 deletions kodilan/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,24 @@
# Application definition

INSTALLED_APPS = [
'posts.apps.PostsConfig',
'django.contrib.admin',
'material.admin',
'material.admin.default',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
# 3rd party
'rest_framework',
'django_filters',
'corsheaders',
# Local
'kodilan',
'posts.apps.PostsConfig'
]

MIDDLEWARE = [
'corsheaders.middleware.CorsMiddleware',
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
Expand All @@ -53,18 +60,31 @@

ROOT_URLCONF = 'kodilan.urls'


CORS_ORIGIN_WHITELIST = (
'https://kodilan.com',
'http://kodilan.com',
'http://localhost:3000',
'http://localhost:8000',
'http://localhost:8081',
'http://localhost:8080',
)

TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'templates')]
,
'DIRS': [
os.path.normpath(os.path.join(BASE_DIR, 'templates')),
],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.media',
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'django.template.context_processors.request',
],
},
},
Expand Down Expand Up @@ -132,5 +152,6 @@

REST_FRAMEWORK = {
'DEFAULT_PAGINATION_CLASS': 'kodilan.customs.StandardResultsSetPagination',
'DEFAULT_FILTER_BACKENDS': ['django_filters.rest_framework.DjangoFilterBackend'],
'PAGE_SIZE': 10
}
2 changes: 1 addition & 1 deletion kodilan/templates/mail/activation.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="container">
<h1>Merhaba {{ first_name }} {{ last_name }}</h1>
<h1>Merhaba {{ company }}</h1>
<p>Kayıt işlemleriniz başarı ile gerçekleştirildi. Aşağıdaki üyelik onay linkine tıklayarak aktivasyon işleminizi
gerçekleştirebilirsiniz.</p>
<p>https://kodilan.com/register/activation?code={{ code }}</p>
Expand Down
2 changes: 1 addition & 1 deletion kodilan/templates/mail/activation.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Merhaba {{ first_name }} {{ last_name }}
Merhaba {{ company }}
Kayıt işlemleriniz başarı ile gerçekleştirildi. Aşağıdaki üyelik onay linkine tıklayarak aktivasyon işleminizi gerçekleştirebilirsiniz.
https://kodilan.com/register/activation?code={{ code }}

Expand Down
21 changes: 21 additions & 0 deletions kodilan/templates/redoc.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!DOCTYPE html>
<html>
<head>
<title>ReDoc</title>
<!-- needed for adaptive design -->
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://fonts.googleapis.com/css?family=Montserrat:300,400,700|Roboto:300,400,700" rel="stylesheet">
<!-- ReDoc doesn't change outer page styles -->
<style>
body {
margin: 0;
padding: 0;
}
</style>
</head>
<body>
<redoc spec-url='{% url schema_url %}'></redoc>
<script src="https://cdn.jsdelivr.net/npm/redoc@next/bundles/redoc.standalone.js"> </script>
</body>
</html>
27 changes: 23 additions & 4 deletions kodilan/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,33 @@
from django.urls import include, path
from rest_framework import routers
from posts import views
from django.views.generic import TemplateView
from rest_framework.schemas import get_schema_view
from rest_framework.renderers import JSONOpenAPIRenderer

router = routers.DefaultRouter()

urlpatterns = [
path('tags/', views.TagsView.as_view()),
path('companies/', views.CompaniesView.as_view()),
path('posts/', views.PostsView.as_view()),
path('locations/', views.FindLocationAction.as_view()),
path('tags', views.TagsView.as_view()),
path('companies', views.CompaniesView.as_view()),
path('posts', views.PostsView.as_view()),
path('posts/slug/<slug:slug>', views.PostView.as_view()),
path('posts/activation/<slug:activation_code>', views.ActivatePostView.as_view()),
path('locations', views.FindLocationAction.as_view()),
path('', include(router.urls)),
path('schema', get_schema_view(
title="Kodilan",
description="API for all things …",
version="0.0.0",
renderer_classes=[JSONOpenAPIRenderer]
), name='docs-schema'),
path('redoc', TemplateView.as_view(
template_name='redoc.html',
extra_context={'schema_url': 'docs-schema'}
), name='docs-redoc'),
path('admin/', admin.site.urls),
]

admin.site.site_header = "Kodilan Admin"
admin.site.site_title = "Kodilan Api"
admin.site.index_title = "Welcome to Kodilan Researcher Admin"
Loading