Compare commits
2 Commits
b69b21d518
...
47fe29d4a4
Author | SHA1 | Date | |
---|---|---|---|
47fe29d4a4 | |||
2ea08f804d |
32
README.md
32
README.md
|
@ -1,2 +1,32 @@
|
|||
# avalon-django
|
||||
Resistance: Avalon web app implemented using Django
|
||||
`avalon-django` is a web-app implementation of the tabletop hidden-roles game
|
||||
[The Resistance: Avalon](https://boardgamegeek.com/boardgame/128882/resistance-avalon)
|
||||
powered by the Python web framework [Django](https://www.djangoproject.com/).
|
||||
|
||||
The impetus for implementing the game electronically was to speed up gameplay
|
||||
by having the computer do the bookkeeping and (optionally) having the computer
|
||||
display a history of public actions to reduce discussion about what had happened
|
||||
so far in the game.
|
||||
|
||||
|
||||
## How to play
|
||||
|
||||
Each player must have their own device (usually a smartphone, but any device
|
||||
with a web browser will work) and go to the URL where the game is hosted.
|
||||
(Feel free to
|
||||
[play on my server](https://aweirdimagination.net/apps/avalon-django).)
|
||||
When creating a game, a 6 letter game code will be generated to identify the
|
||||
game for other players to join. Optionally, a shared device (e.g. a TV or
|
||||
large tablet) may be setup as an "observer" to display the public data on
|
||||
a common display (to make the game more social by avoiding everyone
|
||||
constantly looking at their own phone). Once everyone has joined, follow
|
||||
the on-screen instructions to play; the interface is made assuming everyone
|
||||
already knows the basic game rules.
|
||||
|
||||
|
||||
## Installation
|
||||
|
||||
TODO: Write more detail.
|
||||
|
||||
See the `deploy/awi` branch to see the configuration files used to
|
||||
deploy this on https://avalon.aweirdimagination.net/
|
||||
|
|
|
@ -32,23 +32,13 @@ ALLOWED_HOSTS = []
|
|||
|
||||
INSTALLED_APPS = [
|
||||
'avalon_game.apps.AvalonGameConfig',
|
||||
'django.contrib.admin',
|
||||
'django.contrib.auth',
|
||||
'django.contrib.contenttypes',
|
||||
'django.contrib.sessions',
|
||||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
]
|
||||
|
||||
MIDDLEWARE_CLASSES = [
|
||||
# Does not exist in Django before 1.8.
|
||||
#'django.middleware.security.SecurityMiddleware',
|
||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||
'django.middleware.common.CommonMiddleware',
|
||||
'django.middleware.csrf.CsrfViewMiddleware',
|
||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
|
||||
'django.contrib.messages.middleware.MessageMiddleware',
|
||||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||
]
|
||||
|
||||
|
@ -63,7 +53,6 @@ TEMPLATES = [
|
|||
'context_processors': [
|
||||
'django.template.context_processors.debug',
|
||||
'django.template.context_processors.request',
|
||||
'django.contrib.auth.context_processors.auth',
|
||||
'django.contrib.messages.context_processors.messages',
|
||||
],
|
||||
},
|
||||
|
@ -88,25 +77,6 @@ DATABASES = {
|
|||
}
|
||||
|
||||
|
||||
# Password validation
|
||||
# https://docs.djangoproject.com/en/1.9/ref/settings/#auth-password-validators
|
||||
|
||||
AUTH_PASSWORD_VALIDATORS = [
|
||||
{
|
||||
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
|
||||
},
|
||||
{
|
||||
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
|
||||
},
|
||||
{
|
||||
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
|
||||
},
|
||||
{
|
||||
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
# Internationalization
|
||||
# https://docs.djangoproject.com/en/1.9/topics/i18n/
|
||||
|
||||
|
|
|
@ -15,9 +15,7 @@ Including another URLconf
|
|||
3. Add a URL to urlpatterns: url(r'^blog/', include(blog_urls))
|
||||
"""
|
||||
from django.conf.urls import include, url
|
||||
from django.contrib import admin
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^', include('avalon_game.urls')),
|
||||
url(r'^admin/', admin.site.urls),
|
||||
]
|
||||
|
|
|
@ -29,11 +29,13 @@ class Game(models.Model):
|
|||
display_history = models.NullBooleanField()
|
||||
private_voting = models.NullBooleanField()
|
||||
player_assassinated = models.ForeignKey('Player', null=True, default=None,
|
||||
related_name='+')
|
||||
related_name='+',
|
||||
on_delete=models.PROTECT)
|
||||
created = models.DateTimeField()
|
||||
ended = models.DateTimeField(null=True, default=None)
|
||||
next_game = models.OneToOneField('self', null=True, default=None,
|
||||
related_name='previous_game')
|
||||
related_name='previous_game',
|
||||
on_delete=models.SET_DEFAULT)
|
||||
|
||||
# from http://stackoverflow.com/a/11821832
|
||||
def save(self, *args, **kwargs):
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{% load staticfiles %}
|
||||
{% load static %}
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||
<link href='https://fonts.googleapis.com/css?family=Raleway' rel='stylesheet' type='text/css'>
|
||||
|
|
|
@ -205,7 +205,7 @@ def game_base_context(game, player):
|
|||
context['num_resistance'] = len([p for p in players if not p.is_spy()])
|
||||
resistance_roles = [p.role_string() for p in players
|
||||
if not p.is_spy() and p.role != Player.ROLE_GOOD]
|
||||
if resistance_roles:
|
||||
if resistance_roles and all(r is not None for r in resistance_roles):
|
||||
resistance_roles.sort()
|
||||
context['resistance_roles'] = resistance_roles
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user