Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
thalia
concrexit
Commits
7a26ce27
Verified
Commit
7a26ce27
authored
Aug 03, 2019
by
Sébastiaan Versteeg
Browse files
Remove unused features from partners package
parent
d4acda7b
Changes
9
Hide whitespace changes
Inline
Side-by-side
docs/partners.rst
View file @
7a26ce27
...
@@ -25,14 +25,6 @@ partners.apps module
...
@@ -25,14 +25,6 @@ partners.apps module
:undoc-members:
:undoc-members:
:show-inheritance:
:show-inheritance:
partners.emails module
----------------------
.. automodule:: partners.emails
:members:
:undoc-members:
:show-inheritance:
partners.models module
partners.models module
----------------------
----------------------
...
...
website/partners/admin.py
View file @
7a26ce27
from
django.contrib
import
admin
from
django.contrib
import
admin
from
django.utils.translation
import
gettext_lazy
as
_
from
partners.models
import
(
Partner
,
PartnerEvent
,
PartnerImage
,
from
partners.models
import
(
Partner
,
PartnerEvent
,
PartnerImage
,
Vacancy
,
VacancyCategory
)
Vacancy
,
VacancyCategory
)
...
@@ -15,7 +16,7 @@ class PartnerImageInline(admin.StackedInline):
...
@@ -15,7 +16,7 @@ class PartnerImageInline(admin.StackedInline):
class
PartnerAdmin
(
admin
.
ModelAdmin
):
class
PartnerAdmin
(
admin
.
ModelAdmin
):
"""Class to show partners in the admin."""
"""Class to show partners in the admin."""
prepopulated_fields
=
{
"
slug
"
:
(
"
name
"
,)}
prepopulated_fields
=
{
'
slug
'
:
(
'
name
'
,)}
list_display
=
(
'name'
,
'is_active'
,
'is_main_partner'
,
list_display
=
(
'name'
,
'is_active'
,
'is_main_partner'
,
'is_local_partner'
)
'is_local_partner'
)
search_fields
=
(
'name'
,
'city'
)
search_fields
=
(
'name'
,
'city'
)
...
@@ -30,7 +31,7 @@ class PartnerAdmin(admin.ModelAdmin):
...
@@ -30,7 +31,7 @@ class PartnerAdmin(admin.ModelAdmin):
'is_active'
,
'is_main_partner'
,
'is_local_partner'
,
'is_active'
,
'is_main_partner'
,
'is_local_partner'
,
)
)
}),
}),
(
'Address'
,
{
(
_
(
'Address'
)
,
{
'fields'
:
(
'address'
,
'zip_code'
,
'city'
)
'fields'
:
(
'address'
,
'zip_code'
,
'city'
)
}),
}),
...
@@ -41,7 +42,7 @@ class PartnerAdmin(admin.ModelAdmin):
...
@@ -41,7 +42,7 @@ class PartnerAdmin(admin.ModelAdmin):
class
VacancyCategoryAdmin
(
TranslatedModelAdmin
):
class
VacancyCategoryAdmin
(
TranslatedModelAdmin
):
"""Class to show vacancy categories in the admin."""
"""Class to show vacancy categories in the admin."""
prepopulated_fields
=
{
"
slug
"
:
(
"
name_en
"
,)}
prepopulated_fields
=
{
'
slug
'
:
(
'
name_en
'
,)}
fields
=
[
'name'
,
'slug'
]
fields
=
[
'name'
,
'slug'
]
...
@@ -49,23 +50,20 @@ class VacancyCategoryAdmin(TranslatedModelAdmin):
...
@@ -49,23 +50,20 @@ class VacancyCategoryAdmin(TranslatedModelAdmin):
class
VacancyAdmin
(
admin
.
ModelAdmin
):
class
VacancyAdmin
(
admin
.
ModelAdmin
):
"""Class to show vacancies in the admin."""
"""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'
,)
search_fields
=
(
'title'
,
'partner__name'
,
'company_name'
,)
fieldsets
=
(
fieldsets
=
(
(
None
,
{
(
None
,
{
'fields'
:
(
'title'
,
'description'
,
'link'
,)
'fields'
:
(
'title'
,
'description'
,
'link'
,)
}),
}),
(
'Existing
P
artner'
,
{
(
_
(
'Existing
p
artner'
)
,
{
'fields'
:
(
'partner'
,)
'fields'
:
(
'partner'
,)
}),
}),
(
'Other
P
artner'
,
{
(
_
(
'Other
p
artner'
)
,
{
'fields'
:
(
'company_name'
,
'company_logo'
,)
'fields'
:
(
'company_name'
,
'company_logo'
,)
}),
}),
(
'Categories'
,
{
(
_
(
'Categories'
)
,
{
'fields'
:
(
'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
No preview for this file type
website/partners/locale/nl/LC_MESSAGES/django.po
View file @
7a26ce27
...
@@ -7,8 +7,8 @@ msgid ""
...
@@ -7,8 +7,8 @@ msgid ""
msgstr ""
msgstr ""
"Project-Id-Version: \n"
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-0
6-20
1
6
:4
0
+0200\n"
"POT-Creation-Date: 2019-0
8-03
1
8
:4
7
+0200\n"
"PO-Revision-Date: 2019-0
6-20
1
6
:4
1
+0200\n"
"PO-Revision-Date: 2019-0
8-03
1
8
:4
7
+0200\n"
"Last-Translator: Sébastiaan Versteeg <se_bastiaan@outlook.com>\n"
"Last-Translator: Sébastiaan Versteeg <se_bastiaan@outlook.com>\n"
"Language-Team: \n"
"Language-Team: \n"
"Language: nl\n"
"Language: nl\n"
...
@@ -18,6 +18,22 @@ msgstr ""
...
@@ -18,6 +18,22 @@ msgstr ""
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Poedit 2.2.3\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
#: apps.py templates/partners/index.html templates/partners/partner.html
msgid "Partners"
msgid "Partners"
msgstr "Partners"
msgstr "Partners"
...
@@ -38,6 +54,22 @@ msgstr "plaatje van {}"
...
@@ -38,6 +54,22 @@ msgstr "plaatje van {}"
msgid "Vacancy Categories"
msgid "Vacancy Categories"
msgstr "Vacaturecategorieën"
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
#: models.py
msgid ""
msgid ""
"When you use a partner, the company name and logo below will not be used."
"When you use a partner, the company name and logo below will not be used."
...
@@ -46,8 +78,12 @@ msgstr ""
...
@@ -46,8 +78,12 @@ msgstr ""
"niet gebruikt worden."
"niet gebruikt worden."
#: models.py
#: models.py
msgid "not shown on the page"
msgid "company name"
msgstr "wordt niet getoond op de vacaturepagina"
msgstr "bedrijfsnaam"
#: models.py
msgid "company logo"
msgstr "bedrijfslogo"
#: models.py
#: models.py
msgid "If no partner is used then both a company name and logo are required."
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."
...
@@ -62,14 +98,6 @@ msgstr "Selecteer of een partner of geef een bedrijfsnaam en logo."
msgid "Vacancies"
msgid "Vacancies"
msgstr "Vacatures"
msgstr "Vacatures"
#: models.py
msgid "title"
msgstr "titel"
#: models.py
msgid "description"
msgstr "beschrijving"
#: models.py
#: models.py
msgid "location"
msgid "location"
msgstr "locatie"
msgstr "locatie"
...
@@ -140,10 +168,6 @@ msgstr "Lees meer"
...
@@ -140,10 +168,6 @@ msgstr "Lees meer"
msgid "our local partner"
msgid "our local partner"
msgstr "onze localpartner"
msgstr "onze localpartner"
#: templates/partners/partner.html
msgid "Address"
msgstr "Adres"
#: templates/partners/partner.html
#: templates/partners/partner.html
msgid "Website"
msgid "Website"
msgstr "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):
...
@@ -132,9 +132,15 @@ class VacancyCategory(models.Model, metaclass=ModelTranslateMeta):
class
Vacancy
(
models
.
Model
):
class
Vacancy
(
models
.
Model
):
"""Model describing vacancies."""
"""Model describing vacancies."""
title
=
models
.
CharField
(
max_length
=
255
)
title
=
models
.
CharField
(
description
=
HTMLField
()
_
(
"title"
),
max_length
=
255
)
description
=
HTMLField
(
_
(
"description"
)
)
link
=
models
.
CharField
(
link
=
models
.
CharField
(
_
(
"link"
),
max_length
=
255
,
max_length
=
255
,
blank
=
True
,
blank
=
True
,
validators
=
[
URLValidator
()]
validators
=
[
URLValidator
()]
...
@@ -142,6 +148,7 @@ class Vacancy(models.Model):
...
@@ -142,6 +148,7 @@ class Vacancy(models.Model):
partner
=
models
.
ForeignKey
(
partner
=
models
.
ForeignKey
(
Partner
,
Partner
,
verbose_name
=
_
(
"partner"
),
on_delete
=
models
.
PROTECT
,
on_delete
=
models
.
PROTECT
,
null
=
True
,
null
=
True
,
blank
=
True
,
blank
=
True
,
...
@@ -149,8 +156,13 @@ class Vacancy(models.Model):
...
@@ -149,8 +156,13 @@ class Vacancy(models.Model):
"below will not be used."
)
"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
=
models
.
ImageField
(
_
(
"company logo"
),
upload_to
=
'public/partners/vacancy-logos/'
,
upload_to
=
'public/partners/vacancy-logos/'
,
null
=
True
,
null
=
True
,
blank
=
True
blank
=
True
...
@@ -158,11 +170,6 @@ class Vacancy(models.Model):
...
@@ -158,11 +170,6 @@ class Vacancy(models.Model):
categories
=
models
.
ManyToManyField
(
VacancyCategory
,
blank
=
True
)
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
):
def
get_company_name
(
self
):
"""Return company or partner name."""
"""Return company or partner name."""
if
self
.
partner
:
if
self
.
partner
:
...
@@ -227,6 +234,7 @@ class PartnerEvent(models.Model, metaclass=ModelTranslateMeta):
...
@@ -227,6 +234,7 @@ class PartnerEvent(models.Model, metaclass=ModelTranslateMeta):
partner
=
models
.
ForeignKey
(
partner
=
models
.
ForeignKey
(
Partner
,
Partner
,
verbose_name
=
_
(
"partner"
),
on_delete
=
models
.
CASCADE
,
on_delete
=
models
.
CASCADE
,
related_name
=
"events"
,
related_name
=
"events"
,
blank
=
True
,
blank
=
True
,
...
...
website/utils/management/commands/createfixtures.py
View file @
7a26ce27
...
@@ -409,9 +409,6 @@ class Command(BaseCommand):
...
@@ -409,9 +409,6 @@ class Command(BaseCommand):
vacancy
.
company_logo
.
save
(
vacancy
.
company_name
+
'.jpeg'
,
vacancy
.
company_logo
.
save
(
vacancy
.
company_name
+
'.jpeg'
,
ContentFile
(
icon
))
ContentFile
(
icon
))
if
random
.
random
()
<
0.5
:
vacancy
.
expiration_date
=
_faker
.
date_time_between
(
"-1y"
,
"+1y"
)
vacancy
.
save
()
vacancy
.
save
()
vacancy
.
categories
.
set
(
random
.
sample
(
list
(
categories
),
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