Package: django-wedsite
Overviewdjango-wedsiteaims to provide a quick, easy-to-use open source
django app that allows you to flexibly build a custom website for your
wedding without needing to jump through the typical hoops of getting a
site up and running.You can see anexample of the app running on
Herokuand can see the source of that app onGithub.django-wedsiteships with default settings/text that can easily be
overriden in your main web app.Quick setupClone the example appThe easiest way to get up and running is to clone theexample wedsite
appand then make
modifications from there as neededgit clone https://github.com/dpipemazo/wedsite.gitIf you prefer not to clone, it’s recommended to take a look at and/or
copy the`settings.py<https://github.com/dpipemazo/wedsite/blob/master/example_wedsite/settings.py>`__
and`urls.py<https://github.com/dpipemazo/wedsite/blob/master/example_wedsite/urls.py>`__
from the providedexample wedsite
app. These files configure all
of your example app’s setup to get the basic default wedsite up and
running.Initialize DatabaseIn order to run migrations and initialize the database, you will first
need to set aSECRET_KEYby doing the following in rootdjango-wedsitedirectory:$ echo "DJANGO_SECRET_KEY='$(python -c 'from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())')'" >> .env
$ source .env
$ export DJANGO_SECRET_KEYNow, all you need to do to initialize the database is run the django
migrations, and while you’re at it, create a superuser for later use.$ python manage.py migrate
$ python manage.py createsuperuserLaunchWith that done you should be all set and your site should be serving the
defaultdjango-wedsiteapp. Launch and test!CustomizationOnce the basic site is launched, it’s fun to try out some quick
customization that will give you a feel for how the more advanced
customization will work. In your django app, add a file that will be
used for configuring wedsite. You can use any name, but something likewedsite_conf.pyis recommended. In this file, try out the following
code:from copy import deepcopy
from wedsite.settings import DEFAULT_JSON

CUSTOMIZED_JSON = deepcopy(DEFAULT_JSON)
CUSTOMIZED_JSON['broom']['last_name'] = "Pandas"And now in yoursettings.pyfile, add the followingfrom myapp.wedsite_conf import CUSTOMIZED_JSON

...

WEDSITE_JSON = CUSTOMIZED_JSONYou should now see that the Broom’s last name on the landing page is
“Pandas”. The concept for customizing the whole site would then be to
add as much detail as you’d like to yourCUSTOMIZED_JSON. You should
find that everything you need is in there. See`settings.py<wedsite/settings.py>`__ for all of the fields you can
change.Pages and access restrictionPagesThe site offers the following pages:PageDescriptionindexMain landing pagestoryCute stories about the coupleweddingInfo about the ceremonyeventsInfo about the schedule for the days
surrounding the weddingtravelInfo about airports, hotels, traffic, etc.exploreInfo about what to do in the wedding citygiftsInfo about registries, gifts, donations, etc.teamInfo about the wedding teamcontactWho your guests should contact if they need
helptraditionsInfo about any cultural traditions you’d like
your guests to knowPage AccessAll of the above pages can have three access settings, set in theaccessparameter of theWEDSITE_JSONinsettings.pySettingDescription"all"Everyone can view the page. The page is
public"login"Only authenticated and logged-in users
can view the page. The page is privateFalseThe page is not included in the site.
Nobody can view the page and it is
removed from the navbar, site URLS,
etc.In yourwedsite_conf.py, you can addCUSTOMIZED_JSON['access']['team'] = 'login'to make the team page or any other page login-only.If you’d like to remove a page altogether from the site, you can addCUSTOMIZED_JSON['access']['contact'] = FalseThere is one special page, the RSVP page, which cannot be removed from
the site and is always restricted to only logged-in users.Package ArchitectureOverviewThe site primarily serves up static pages of django-templated HTML. The
main dynamic features of the site are:User AccountsUser RSVPsUser mass emailingPage view restriction to authorized usersAdmin UIStatic PagesTemplatesPage templates are split into two categories: blocks and pages. Blocks
are pieces of code that are utilized in multiple pages and pages utilize
blocks to build a full web page.The main block for the site is`base.html<templates/wedding/blocks/base.html>`__ which defines the
navbar, javascript, title, footer and all other shared resources for the
site.Each of the`pages<wedding/blocks/pages>`__ then imports the base
template and generally just fills in the page title and content.URLs and access restrictionThe site map is defined in`urls.py<wedding/urls.py>`__. If you
were going to add/remove a page it should be done here. For each page
that you want to serve on the site, add a line to theurlpatternslist. In the line you’ll need to specify the page template for the site
as well as the view class you’d like to use to serve the template. Note
that for static HTML pages there are two view choices:StaticViewStaticViewNoAuthIf you chooseStaticViewthen it will require a user to log in to
access the page, else if you chooseStaticViewNoAuththe page will
be accessible without login.Adding a basic page to the siteUsing just your knowledge of templates and URLS from above you can go
ahead and add a new page to the site! Simply make a new template in thepagesdirectory and add its desired URL to theurlpatternswith
eitherStaticVieworStaticViewNoAuthand you should be good to
go!Users and RSVPsUser ModelThis site uses the standard Django user model. The standard django
account pages have been skinned in the theme of the site in the`registrationtemplates <templates/registration>`__. In order to get
some flexibility in the user data a`Profile<wedding/models.py>`__
model has been added as a 1:1 field with a user, created when the user
is created. Eventually the goal is to add a “user account” page to the
site where users can update their address and contact info using this
profile but those features aren’t yet built.User Account CreationA custom account creation view has been built such that only users who
have a valid RSVP in the system can create an account. The site
currently checks a user’s last name and the numerical digits of their
address for a match in the “unclaimed” RSVPs in the database. An
“unclaimed” RSVP is an RSVP which does not have a Foreign Key to a user.
The admin of the site needs to manually enter all of their guests into
the database as described below.RSVP ModelsThe RSVP system consists of two models: RSVP and RSVP PersonRSVP ModelThe RSVP maps 1:1 to an invitation you sent out. It has the following
important fields:FieldDescriptionlast_namesComma-separated last names for anyone
expected to claim the inviteaddressFull address that the invite was sent to.
Only the numbers really matterresponseComent section the user can fill out when
submitting their responseAn RSVP contains a 1:many relationship with RSVP PersonsRSVP Person ModelsEach RSVP Person has the following important fieldsFieldDescriptionnamePerson’s NameAlong with the above fields, the RSVP person model can and should be
modified to contain any/all of the information you’d like to gather from
the person when they submit their response on the web site. The default
RSVP person contains the following additional fieldsFieldTypeDescriptionis_attending_r ehearsalBooleanWhether or not they’re attending
the rehearsal dinneris_attending_w eddingBooleanWhether or not they’re attending
the weddingis_childBooleanWhether or not the guest counts
as a childdietary_*BooleanVarious dietary restrictionstableIntegerCurrently unused, but would be
nice for building a seating
assignment chartLoading RSVPs into the siteWith a basic understanding of the above RSVP system, you’ll want to go
ahead and load your RSVPs into the system so that your users can claim
them. To do this, log into the admin UI athttps://my_site/adminusing your superuser credentials. Then go to theRSVPpage and you
can manually add RSVPs. This can indeed be a bit tedious; it would be
nice to create a management command to take in a CSV or JSON data file
and make all of the RSVP objects.