Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
concrexit
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
70
Issues
70
List
Boards
Labels
Service Desk
Milestones
Merge Requests
10
Merge Requests
10
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
thalia
concrexit
Commits
7a26ce27
Verified
Commit
7a26ce27
authored
Aug 03, 2019
by
Sébastiaan Versteeg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unused features from partners package
parent
d4acda7b
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
127 additions
and
104 deletions
+127
-104
docs/partners.rst
docs/partners.rst
+0
-8
website/partners/admin.py
website/partners/admin.py
+8
-10
website/partners/emails.py
website/partners/emails.py
+0
-37
website/partners/locale/nl/LC_MESSAGES/django.mo
website/partners/locale/nl/LC_MESSAGES/django.mo
+0
-0
website/partners/locale/nl/LC_MESSAGES/django.po
website/partners/locale/nl/LC_MESSAGES/django.po
+40
-16
website/partners/management/commands/sendvacancyexpirationnotification.py
.../management/commands/sendvacancyexpirationnotification.py
+0
-22
website/partners/migrations/0015_auto_20190803_1846.py
website/partners/migrations/0015_auto_20190803_1846.py
+63
-0
website/partners/models.py
website/partners/models.py
+16
-8
website/utils/management/commands/createfixtures.py
website/utils/management/commands/createfixtures.py
+0
-3
No files found.
docs/partners.rst
View file @
7a26ce27
...
...
@@ -25,14 +25,6 @@ partners.apps module
:undoc-members:
:show-inheritance:
partners.emails module
----------------------
.. automodule:: partners.emails
:members:
:undoc-members:
:show-inheritance:
partners.models module
----------------------
...
...
website/partners/admin.py
View file @
7a26ce27
from
django.contrib
import
admin
from
django.utils.translation
import
gettext_lazy
as
_
from
partners.models
import
(
Partner
,
PartnerEvent
,
PartnerImage
,
Vacancy
,
VacancyCategory
)
...
...
@@ -15,7 +16,7 @@ class PartnerImageInline(admin.StackedInline):
class
PartnerAdmin
(
admin
.
ModelAdmin
):
"""Class to show partners in the admin."""
prepopulated_fields
=
{
"slug"
:
(
"name"
,)}
prepopulated_fields
=
{
'slug'
:
(
'name'
,)}
list_display
=
(
'name'
,
'is_active'
,
'is_main_partner'
,
'is_local_partner'
)
search_fields
=
(
'name'
,
'city'
)
...
...
@@ -30,7 +31,7 @@ class PartnerAdmin(admin.ModelAdmin):
'is_active'
,
'is_main_partner'
,
'is_local_partner'
,
)
}),
(
'Address'
,
{
(
_
(
'Address'
)
,
{
'fields'
:
(
'address'
,
'zip_code'
,
'city'
)
}),
...
...
@@ -41,7 +42,7 @@ class PartnerAdmin(admin.ModelAdmin):
class
VacancyCategoryAdmin
(
TranslatedModelAdmin
):
"""Class to show vacancy categories in the admin."""
prepopulated_fields
=
{
"slug"
:
(
"name_en"
,)}
prepopulated_fields
=
{
'slug'
:
(
'name_en'
,)}
fields
=
[
'name'
,
'slug'
]
...
...
@@ -49,23 +50,20 @@ class VacancyCategoryAdmin(TranslatedModelAdmin):
class
VacancyAdmin
(
admin
.
ModelAdmin
):
"""Class to show vacancies in the admin."""
list_display
=
(
'title'
,
'partner'
,
'company_name'
,
'expiration_date'
)
list_display
=
(
'title'
,
'partner'
,
'company_name'
)
search_fields
=
(
'title'
,
'partner__name'
,
'company_name'
,)
fieldsets
=
(
(
None
,
{
'fields'
:
(
'title'
,
'description'
,
'link'
,)
}),
(
'Existing Partner'
,
{
(
_
(
'Existing partner'
)
,
{
'fields'
:
(
'partner'
,)
}),
(
'Other Partner'
,
{
(
_
(
'Other partner'
)
,
{
'fields'
:
(
'company_name'
,
'company_logo'
,)
}),
(
'Categories'
,
{
(
_
(
'Categories'
)
,
{
'fields'
:
(
'categories'
,)
}),
(
'Other'
,
{
'fields'
:
(
'remarks'
,
'expiration_date'
)
})
)
...
...
website/partners/emails.py
deleted
100644 → 0
View file @
d4acda7b
import
datetime
from
django.conf
import
settings
from
django.core.mail
import
EmailMessage
from
django.utils
import
timezone
from
partners.models
import
Vacancy
def
send_vacancy_expiration_notifications
(
dry_run
=
False
):
"""Send a notification about expiring vacancies."""
# Select vacencies that expire in roughly a month, wherefor
# a mail hasn't been sent yet to Mr/Mrs Extern
expired_vacancies
=
Vacancy
.
objects
.
filter
(
expiration_mail_sent
=
False
,
expiration_date__lt
=
timezone
.
now
().
date
()
+
datetime
.
timedelta
(
days
=
30
)
)
for
exp_vacancy
in
expired_vacancies
:
# Create Message
subject
=
(
'[WEBSITE] Vacancy
\'
{}
\'
by {} will soon expire'
.
format
(
exp_vacancy
.
title
,
exp_vacancy
.
get_company_name
()))
text_message
=
(
'Hello!
\n\n
A vacancy of {},
\'
{}
\'
will '
'expire within the next 30 days.'
'
\n\n
Kind regards,
\n
The website'
.
format
(
exp_vacancy
.
title
,
exp_vacancy
.
get_company_name
()))
if
not
dry_run
:
# Send Mail
EmailMessage
(
subject
,
text_message
,
to
=
[
settings
.
PARTNER_NOTIFICATION_ADDRESS
]
).
send
()
# Save that mail has been sent into database
exp_vacancy
.
expiration_mail_sent
=
True
exp_vacancy
.
save
()
website/partners/locale/nl/LC_MESSAGES/django.mo
View file @
7a26ce27
This diff was suppressed by a .gitattributes entry.
website/partners/locale/nl/LC_MESSAGES/django.po
View file @
7a26ce27
...
...
@@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-0
6-20 16:40
+0200\n"
"PO-Revision-Date: 2019-0
6-20 16:41
+0200\n"
"POT-Creation-Date: 2019-0
8-03 18:47
+0200\n"
"PO-Revision-Date: 2019-0
8-03 18:47
+0200\n"
"Last-Translator: Sébastiaan Versteeg <se_bastiaan@outlook.com>\n"
"Language-Team: \n"
"Language: nl\n"
...
...
@@ -18,6 +18,22 @@ msgstr ""
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Poedit 2.2.3\n"
#: admin.py templates/partners/partner.html
msgid "Address"
msgstr "Adres"
#: admin.py
msgid "Existing partner"
msgstr "Bestaande partner"
#: admin.py
msgid "Other partner"
msgstr "Andere partner"
#: admin.py
msgid "Categories"
msgstr "Categorieën"
#: apps.py templates/partners/index.html templates/partners/partner.html
msgid "Partners"
msgstr "Partners"
...
...
@@ -38,6 +54,22 @@ msgstr "plaatje van {}"
msgid "Vacancy Categories"
msgstr "Vacaturecategorieën"
#: models.py
msgid "title"
msgstr "titel"
#: models.py
msgid "description"
msgstr "beschrijving"
#: models.py
msgid "link"
msgstr "link"
#: models.py
msgid "partner"
msgstr "partner"
#: models.py
msgid ""
"When you use a partner, the company name and logo below will not be used."
...
...
@@ -46,8 +78,12 @@ msgstr ""
"niet gebruikt worden."
#: models.py
msgid "not shown on the page"
msgstr "wordt niet getoond op de vacaturepagina"
msgid "company name"
msgstr "bedrijfsnaam"
#: models.py
msgid "company logo"
msgstr "bedrijfslogo"
#: models.py
msgid "If no partner is used then both a company name and logo are required."
...
...
@@ -62,14 +98,6 @@ msgstr "Selecteer of een partner of geef een bedrijfsnaam en logo."
msgid "Vacancies"
msgstr "Vacatures"
#: models.py
msgid "title"
msgstr "titel"
#: models.py
msgid "description"
msgstr "beschrijving"
#: models.py
msgid "location"
msgstr "locatie"
...
...
@@ -140,10 +168,6 @@ msgstr "Lees meer"
msgid "our local partner"
msgstr "onze localpartner"
#: templates/partners/partner.html
msgid "Address"
msgstr "Adres"
#: templates/partners/partner.html
msgid "Website"
msgstr "Website"
...
...
website/partners/management/commands/sendvacancyexpirationnotification.py
deleted
100644 → 0
View file @
d4acda7b
from
django.core.management.base
import
BaseCommand
from
partners
import
emails
class
Command
(
BaseCommand
):
"""Command class for sendvacancyexpirationnotification command."""
def
add_arguments
(
self
,
parser
):
"""Add --dry-run argument to command."""
parser
.
add_argument
(
'--dry-run'
,
action
=
'store_true'
,
dest
=
'dry-run'
,
default
=
False
,
help
=
'Dry run instead of sending e-mail'
,
)
def
handle
(
self
,
*
args
,
**
options
):
"""Call the function to handle the sending of emails."""
emails
.
send_vacancy_expiration_notifications
(
bool
(
options
[
'dry-run'
]))
website/partners/migrations/0015_auto_20190803_1846.py
0 → 100644
View file @
7a26ce27
# Generated by Django 2.2.1 on 2019-08-03 16:46
import
django.core.validators
from
django.db
import
migrations
,
models
import
django.db.models.deletion
import
tinymce.models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'partners'
,
'0014_partner_is_local_partner'
),
]
operations
=
[
migrations
.
RemoveField
(
model_name
=
'vacancy'
,
name
=
'expiration_date'
,
),
migrations
.
RemoveField
(
model_name
=
'vacancy'
,
name
=
'expiration_mail_sent'
,
),
migrations
.
RemoveField
(
model_name
=
'vacancy'
,
name
=
'remarks'
,
),
migrations
.
AlterField
(
model_name
=
'partnerevent'
,
name
=
'partner'
,
field
=
models
.
ForeignKey
(
blank
=
True
,
null
=
True
,
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
related_name
=
'events'
,
to
=
'partners.Partner'
,
verbose_name
=
'partner'
),
),
migrations
.
AlterField
(
model_name
=
'vacancy'
,
name
=
'company_logo'
,
field
=
models
.
ImageField
(
blank
=
True
,
null
=
True
,
upload_to
=
'public/partners/vacancy-logos/'
,
verbose_name
=
'company logo'
),
),
migrations
.
AlterField
(
model_name
=
'vacancy'
,
name
=
'company_name'
,
field
=
models
.
CharField
(
blank
=
True
,
max_length
=
255
,
verbose_name
=
'company name'
),
),
migrations
.
AlterField
(
model_name
=
'vacancy'
,
name
=
'description'
,
field
=
tinymce
.
models
.
HTMLField
(
verbose_name
=
'description'
),
),
migrations
.
AlterField
(
model_name
=
'vacancy'
,
name
=
'link'
,
field
=
models
.
CharField
(
blank
=
True
,
max_length
=
255
,
validators
=
[
django
.
core
.
validators
.
URLValidator
()],
verbose_name
=
'link'
),
),
migrations
.
AlterField
(
model_name
=
'vacancy'
,
name
=
'partner'
,
field
=
models
.
ForeignKey
(
blank
=
True
,
help_text
=
'When you use a partner, the company name and logo below will not be used.'
,
null
=
True
,
on_delete
=
django
.
db
.
models
.
deletion
.
PROTECT
,
to
=
'partners.Partner'
,
verbose_name
=
'partner'
),
),
migrations
.
AlterField
(
model_name
=
'vacancy'
,
name
=
'title'
,
field
=
models
.
CharField
(
max_length
=
255
,
verbose_name
=
'title'
),
),
]
website/partners/models.py
View file @
7a26ce27
...
...
@@ -132,9 +132,15 @@ class VacancyCategory(models.Model, metaclass=ModelTranslateMeta):
class
Vacancy
(
models
.
Model
):
"""Model describing vacancies."""
title
=
models
.
CharField
(
max_length
=
255
)
description
=
HTMLField
()
title
=
models
.
CharField
(
_
(
"title"
),
max_length
=
255
)
description
=
HTMLField
(
_
(
"description"
)
)
link
=
models
.
CharField
(
_
(
"link"
),
max_length
=
255
,
blank
=
True
,
validators
=
[
URLValidator
()]
...
...
@@ -142,6 +148,7 @@ class Vacancy(models.Model):
partner
=
models
.
ForeignKey
(
Partner
,
verbose_name
=
_
(
"partner"
),
on_delete
=
models
.
PROTECT
,
null
=
True
,
blank
=
True
,
...
...
@@ -149,8 +156,13 @@ class Vacancy(models.Model):
"below will not be used."
)
)
company_name
=
models
.
CharField
(
max_length
=
255
,
blank
=
True
)
company_name
=
models
.
CharField
(
_
(
"company name"
),
max_length
=
255
,
blank
=
True
)
company_logo
=
models
.
ImageField
(
_
(
"company logo"
),
upload_to
=
'public/partners/vacancy-logos/'
,
null
=
True
,
blank
=
True
...
...
@@ -158,11 +170,6 @@ class Vacancy(models.Model):
categories
=
models
.
ManyToManyField
(
VacancyCategory
,
blank
=
True
)
expiration_date
=
models
.
DateField
(
null
=
True
,
blank
=
True
)
expiration_mail_sent
=
models
.
BooleanField
(
default
=
False
)
remarks
=
HTMLField
(
blank
=
True
,
help_text
=
_
(
'not shown on the page'
))
def
get_company_name
(
self
):
"""Return company or partner name."""
if
self
.
partner
:
...
...
@@ -227,6 +234,7 @@ class PartnerEvent(models.Model, metaclass=ModelTranslateMeta):
partner
=
models
.
ForeignKey
(
Partner
,
verbose_name
=
_
(
"partner"
),
on_delete
=
models
.
CASCADE
,
related_name
=
"events"
,
blank
=
True
,
...
...
website/utils/management/commands/createfixtures.py
View file @
7a26ce27
...
...
@@ -409,9 +409,6 @@ class Command(BaseCommand):
vacancy
.
company_logo
.
save
(
vacancy
.
company_name
+
'.jpeg'
,
ContentFile
(
icon
))
if
random
.
random
()
<
0.5
:
vacancy
.
expiration_date
=
_faker
.
date_time_between
(
"-1y"
,
"+1y"
)
vacancy
.
save
()
vacancy
.
categories
.
set
(
random
.
sample
(
list
(
categories
),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment