Skip to content

Commit a7b183f

Browse files
authored
Cleanup random Django version support docs (#86)
No code changes, just: * upgrade dev dependencies * unify django version specific code comments to be `DJANGO<version>` * update workflows to use more modern versions #### Verifying change * `make build` * `make run` * Browse to localhost:8000/admin/ * login with `admin`/`admin`
1 parent 430be02 commit a7b183f

File tree

7 files changed

+20
-23
lines changed

7 files changed

+20
-23
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM python:2.7-alpine
1+
FROM python:3.6-alpine3.7
22

33
RUN apk add --no-cache make
44

Makefile

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,19 +44,18 @@ coverage: ## Run and then display coverage report
4444

4545
resetdb: ## Delete and then recreate the dev sqlite database
4646
python $(MANAGE) reset_db --router=default --noinput
47-
-python $(MANAGE) syncdb --noinput
48-
-python $(MANAGE) migrate --noinput
47+
python $(MANAGE) migrate --noinput
4948
python $(MANAGE) loaddata sample_data
5049

5150
.PHONY: build
5251
build: ## Build a full set of Docker images
53-
build: build/2.0 build/1.11.1 build/1.10.7 build/1.9.13 build/1.8.18
52+
build: build/2.0 build/1.11.11 build/1.10.8 build/1.9.13 build/1.8.18
5453

5554
build/%:
5655
docker build --build-arg DJANGO_VERSION=$* \
5756
-t $(IMAGE):$$(echo "$*" | cut -f 1-2 -d.) .
5857

59-
run: run/1.11
58+
run: run/2.0
6059

6160
run/%:
6261
docker run --rm -p 8000:8000 -it $(IMAGE):$*
@@ -67,14 +66,12 @@ docker/publish: ## Publish Docker images to the hub
6766
docker push $(IMAGE):1.10
6867
docker push $(IMAGE):1.9
6968
docker push $(IMAGE):1.8
70-
docker push $(IMAGE):1.7
71-
docker push $(IMAGE):1.6
7269

7370
test/%:
7471
docker run --rm -p 8000:8000 -t $(IMAGE):$* make test
7572

7673
bash:
77-
docker run --rm -it $(IMAGE):1.9 /bin/bash
74+
docker run --rm -it $(IMAGE):2.0 /bin/bash
7875

7976
version:
8077
@sed -i -r /version/s/[0-9.]+/$(VERSION)/ setup.py

django_object_actions/models.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1+
# DJANGO1.7 https://docs.djangoproject.com/en/2.0/releases/1.7/#app-loading-refactor
2+
# DELETEME and use an app config
13
# Empty models.py so django picks the templates

example_project/polls/models.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class Poll(models.Model):
99
question = models.CharField(max_length=200)
1010
pub_date = models.DateTimeField('date published')
1111

12-
def __unicode__(self):
12+
def __str__(self):
1313
return self.question
1414

1515
def was_published_recently(self):
@@ -24,13 +24,13 @@ class Choice(models.Model):
2424
choice_text = models.CharField(max_length=200)
2525
votes = models.IntegerField()
2626

27-
def __unicode__(self):
27+
def __str__(self):
2828
return self.choice_text
2929

3030

3131
class Comment(models.Model):
3232
uuid = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
3333
comment = models.TextField(null=True, blank=True)
3434

35-
def __unicode__(self):
35+
def __str__(self):
3636
return self.comment or ''

example_project/settings.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ def project_dir(*paths):
3636

3737
ROOT_URLCONF = 'example_project.urls'
3838

39+
# DJANGO1.9 switch to only MIDDLEWARE
3940
MIDDLEWARE_CLASSES = MIDDLEWARE = (
4041
'django.contrib.sessions.middleware.SessionMiddleware',
4142
'django.middleware.common.CommonMiddleware',
@@ -75,8 +76,3 @@ def project_dir(*paths):
7576
},
7677
},
7778
]
78-
79-
# DJANGO1.7
80-
SILENCED_SYSTEM_CHECKS = [
81-
'1_7.W001',
82-
]

requirements.txt

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@
44
#
55
# pip-compile --output-file requirements.txt requirements.in
66
#
7-
coverage==4.4.1
8-
dj-database-url==0.4.2
7+
coverage==4.5.1
8+
dj-database-url==0.5.0
99
django-extensions==2.0.0
10-
factory-boy==2.8.1
11-
faker==0.7.17
10+
factory-boy==2.10.0
11+
faker==0.8.11 # via factory-boy
1212
mock==2.0.0
13-
pbr==3.0.1 # via mock
14-
python-dateutil==2.6.0 # via faker
15-
six==1.10.0 # via django-extensions, faker, mock, python-dateutil
13+
pbr==3.1.1 # via mock
14+
python-dateutil==2.6.1 # via faker
15+
six==1.11.0 # via django-extensions, faker, mock, python-dateutil
16+
text-unidecode==1.2 # via faker
1617
typing==3.6.4 # via django-extensions
1718
uuid==1.30

setup.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
universal = 1
33

44
[flake8]
5+
# exclude = migrations django_object_actions/__init__.py
56
max-line-length = 90

0 commit comments

Comments
 (0)