Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 02c2998

Browse filesBrowse files
Add required kwargs to foreignkey fields on job models
1 parent 08e5ead commit 02c2998
Copy full SHA for 02c2998

File tree

Expand file treeCollapse file tree

3 files changed

+33
-11
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

3 files changed

+33
-11
lines changed
Open diff view settings
Collapse file

‎jobs/migrations/0001_initial.py‎

Copy file name to clipboardExpand all lines: jobs/migrations/0001_initial.py
+25-6Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from django.db import models, migrations
55
import taggit.managers
66
from django.conf import settings
7-
import django_markdown.models
7+
from markdownx import models as mdx_models
88

99

1010
class Migration(migrations.Migration):
@@ -20,11 +20,18 @@ class Migration(migrations.Migration):
2020
fields=[
2121
('id', models.AutoField(serialize=False, primary_key=True, verbose_name='ID', auto_created=True)),
2222
('name', models.CharField(max_length=255)),
23-
('profile', django_markdown.models.MarkdownField()),
23+
('profile', mdx_models.MarkdownxField()),
2424
('homepage', models.URLField()),
2525
('created_at', models.DateTimeField(auto_now_add=True)),
2626
('updated_at', models.DateTimeField(auto_now=True)),
27-
('user', models.ForeignKey(to=settings.AUTH_USER_MODEL)),
27+
(
28+
'user',
29+
models.ForeignKey(
30+
to=settings.AUTH_USER_MODEL,
31+
null=True,
32+
on_delete=models.SET_NULL,
33+
),
34+
),
2835
],
2936
options={
3037
'verbose_name_plural': 'companies',
@@ -36,14 +43,26 @@ class Migration(migrations.Migration):
3643
fields=[
3744
('id', models.AutoField(serialize=False, primary_key=True, verbose_name='ID', auto_created=True)),
3845
('title', models.CharField(max_length=255)),
39-
('description', django_markdown.models.MarkdownField()),
46+
('description', mdx_models.MarkdownxField()),
4047
('location', models.CharField(max_length=255)),
4148
('application_url', models.URLField()),
4249
('created_at', models.DateTimeField(auto_now_add=True)),
4350
('updated_at', models.DateTimeField(auto_now=True)),
44-
('company', models.ForeignKey(to='jobs.Company')),
51+
(
52+
'company',
53+
models.ForeignKey(
54+
to='jobs.Company',
55+
on_delete=models.CASCADE,
56+
)
57+
),
4558
('tags', taggit.managers.TaggableManager(to='taggit.Tag', help_text='A comma-separated list of tags.', verbose_name='Tags', through='taggit.TaggedItem')),
46-
('user', models.ForeignKey(to=settings.AUTH_USER_MODEL)),
59+
(
60+
'user',
61+
models.ForeignKey(
62+
to=settings.AUTH_USER_MODEL,
63+
on_delete=models.CASCADE,
64+
),
65+
),
4766
],
4867
options={
4968
},
Collapse file

‎jobs/migrations/0006_auto_20150625_0141.py‎

Copy file name to clipboardExpand all lines: jobs/migrations/0006_auto_20150625_0141.py
+6-1Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,12 @@ class Migration(migrations.Migration):
2121
migrations.AlterField(
2222
model_name='company',
2323
name='user',
24-
field=models.ForeignKey(related_name='companies', to=settings.AUTH_USER_MODEL),
24+
field=models.ForeignKey(
25+
related_name='companies',
26+
to=settings.AUTH_USER_MODEL,
27+
null=True,
28+
on_delete=models.SET_NULL,
29+
),
2530
preserve_default=True,
2631
),
2732
]
Collapse file

‎jobs/models.py‎

Copy file name to clipboardExpand all lines: jobs/models.py
+2-4Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,11 @@ class Job(models.Model):
3232
user = models.ForeignKey(
3333
User,
3434
related_name='jobs',
35-
null=True,
36-
on_delete=models.SET_NULL,
35+
on_delete=models.CASCADE,
3736
)
3837
company = models.ForeignKey(
3938
Company,
40-
null=True,
41-
on_delete=models.SET_NULL,
39+
on_delete=models.CASCADE,
4240
related_name='jobs',
4341
)
4442
is_approved = models.BooleanField(default=False)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.