GithubHelp home page GithubHelp logo

djangogirls / tutorial-extensions Goto Github PK

View Code? Open in Web Editor NEW
162.0 28.0 202.0 4.56 MB

Additional tasks for tutorial

Home Page: https://tutorial-extensions.djangogirls.org

License: Other

Makefile 100.00%

tutorial-extensions's Introduction

Django Girls Tutorial: Extensions

Info This work is licensed under the Creative Commons Attribution-ShareAlike 4.0 International License. To view a copy of this license, visit https://creativecommons.org/licenses/by-sa/4.0/

Introduction

This book contains additional tutorials you can do after you're finished with Django Girls Tutorial.

Current tutorials are:

English

Contributing

These tutorials are maintained by DjangoGirls. If you find any mistakes or want to update the tutorial please follow the contributing guidelines.

tutorial-extensions's People

Contributors

allardbrain avatar amakarudze avatar aniav avatar corazzon avatar das-g avatar faheel avatar ftnext avatar helenst avatar hjwp avatar kaizumaki avatar kojoidrissa avatar lexifdev avatar loridean avatar magul avatar moonshain avatar morozzzko avatar myalkabov avatar nnkps avatar olasitarska avatar patjouk avatar peconia avatar phalt avatar rahimz avatar safety-panda avatar saghul avatar sarajoha avatar sujinleeme avatar takaakifuruse avatar trueskawka avatar zaccc123 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tutorial-extensions's Issues

Deploy to Heroku: whitenoise instructions are outdated and local_settings aren't currently applied locally

1. Whitenoise instructions

Currently the tutorial has following guidance to install whitenoise (from https://tutorial-extensions.djangogirls.org/en/heroku/#mysitewsgipy):

from whitenoise.django import DjangoWhiteNoise
application = DjangoWhiteNoise(application)

For whitenoise v4.* onwards (released Aug 2018), changelog states:

The WSGI integration option for Django (which involved editing wsgi.py) has been removed. > Instead, you should add WhiteNoise to your middleware list in settings.py and remove any reference to WhiteNoise from wsgi.py. See the documentation for more details.
(The pure WSGI integration is still available for non-Django apps.)

Here's new guidelines (from http://whitenoise.evans.io/en/stable/django.html):

Edit your settings.py file and add WhiteNoise to the MIDDLEWARE list. The WhiteNoise middleware should be placed directly after the Django SecurityMiddleware (if you are using it) and before all other middleware:

MIDDLEWARE = [
  'django.middleware.security.SecurityMiddleware',
  'whitenoise.middleware.WhiteNoiseMiddleware',
  # ...
]

That’s it – WhiteNoise will now serve your static files. However, to get the best performance you should proceed to step 3 below and enable compression and caching.

To add automatic compression with the caching behaviour provided by Django’s ManifestStaticFilesStorage backend, add this also to settings.py

STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'

2. local_settings.py

Whilst better options are available for handling environmental settings configuration, I understand that using local_settings.py is easy to understand and does the job well enough. However, it's not being applied locally in these instructions: https://tutorial-extensions.djangogirls.org/en/heroku/#mysitelocalsettingspy

To apply these locally, we just need to add following to the bottom of settings.py:

# Override with local_settings if it exists
try:
    from .local_settings import *
except ImportError:
    pass

NameError in URL declaration of post_draft_list

Hey all!

While following the tutorial I encountered a NameError:

File "/home/patrik/dev/django-blog/blog/urls.py", line 9, in <module>
    url(r'^drafts/$', views.post_draft_list, name='post_draft_list'),
NameError: name 'url' is not defined

The naming convention in the beginner tutorial was path instead of url. Applying this solves the NameError.

Also the regular expression r'^drafts/$' is unconventional up to this point. I declared 'drafts/' instead to follow the scheme.

What's your opinion on the raised error?

After discussion I would volunteer to PR request a merge solving this issue.

Can't access postgres shell

Hi if I write:

$ psql

As recommended into your postgres tutorial. This will yield:

psql: FATAL: database "username" does not exist

While username is the linux ubuntu username. Can you write how to get around this?

Authorization/authentications issues, spanish version: url statements, link to old documentation

Hi! I noticed a few issues in the secure your website section, in the Spanish version. They are:

  • Urls patterns not updated (using url statement instead of path)
  • Login and logout urls use views.login instead of views.LoginView.as_view()
  • There's a link to the documentation of Django's 1.10 version
  • A sentence in the Log in users section, when asking to add a setting to mysite/settings.py is not very clear.

If it's okay, I'd like to volunteer to fix them.

base.html in mysite

Reported by a student:
There seems to be some confusion around base.html.
The tutorial suggests operations (login.html extends base.html) on mysite/base.html which is not created until later on in the tutorial - 'Improving the layout' - where improvement is done on a file which does not exist.

"Patterns" and multiple discrepancies.

In the mysite/urls.py, the code is completely different than how the Django Girls tutorial ends:

It looks like:

from django.conf.urls import include, url
from django.contrib import admin

urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'', include('blog.urls')),
]

The "Homework: secure your website" shows:

from django.conf.urls import include, url
import django.contrib.auth.views

from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
url(r'^admin/', include(admin.site.urls)),
url(r'^accounts/login/$', django.contrib.auth.views.login, name='login'),
url(r'^accounts/logout/$', django.contrib.auth.views.logout, name='logout', kwargs={'next_page': '/'}),
url(r'', include('blog.urls')),
)

When importing "patterns", Python throws an error that it is deprecated since v1.10.

Support for string view arguments to url() is deprecated

Hello,
Looking at this page : https://djangogirls.gitbooks.io/django-girls-tutorial-extensions/content/authentication_authorization/index.html#login-users

I got a warning such as :

RemovedInDjango110Warning: Support for string view arguments to url() is deprecated and will be removed in Django 1.10 (got django.contrib.auth.views.login). Pass the callable instead.
url(r'^accounts/login/$', 'django.contrib.auth.views.login'),

Maybe you could change urls.py such as the following or any other more usual way :

from django.conf.urls import patterns, include, url
import django.contrib.auth.views as auth_views

from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
    url(r'^admin/', include(admin.site.urls)),
    url(r'^accounts/login/$', auth_views.login, name="auth_views.login"),
    url(r'', include('blog.urls')),
)

Kinds

Problems with Deploy your website on Heroku

I'm working through the exercise and is running into issues with database migration. I followed the instructions to change to PostgreSQL installation. I run $ heroku run python manage.py migrate and I get all the stats staying ok. But yet when I run $ heroku run python manage.py createsuperuser I get errors saying database doesn't exist. I tried googling for answers but can't find a solution. Are these instructions outdated compared to Heroku?

(myvenv) Yenlys-MacBook-Pro:django_girls yenlyma$ heroku run python manage.py migrate
Running python manage.py migrate on ⬢ ydgblog... up, run.6320 (Free)
Operations to perform:
  Apply all migrations: admin, auth, blog, contenttypes, sessions
Running migrations:
  Applying contenttypes.0001_initial... OK
  Applying auth.0001_initial... OK
  Applying admin.0001_initial... OK
  Applying admin.0002_logentry_remove_auto_add... OK
  Applying contenttypes.0002_remove_content_type_name... OK
  Applying auth.0002_alter_permission_name_max_length... OK
  Applying auth.0003_alter_user_email_max_length... OK
  Applying auth.0004_alter_user_username_opts... OK
  Applying auth.0005_alter_user_last_login_null... OK
  Applying auth.0006_require_contenttypes_0002... OK
  Applying auth.0007_alter_validators_add_error_messages... OK
  Applying auth.0008_alter_user_username_max_length... OK
  Applying blog.0001_initial... OK
  Applying blog.0002_comment... OK
  Applying sessions.0001_initial... OK
(myvenv) Yenlys-MacBook-Pro:django_girls yenlyma$ heroku run python manage.py createsuperuser
Running python manage.py createsuperuser on ⬢ ydgblog... up, run.4890 (Free)

You have 15 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, blog, contenttypes, sessions.
Run 'python manage.py migrate' to apply them.

Traceback (most recent call last):
  File "/app/.heroku/python/lib/python3.5/site-packages/django/db/backends/utils.py", line 64, in execute
    return self.cursor.execute(sql, params)
  File "/app/.heroku/python/lib/python3.5/site-packages/django/db/backends/sqlite3/base.py", line 337, in execute
    return Database.Cursor.execute(self, query, params)
sqlite3.OperationalError: no such table: auth_user

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "manage.py", line 22, in <module>
    execute_from_command_line(sys.argv)
  File "/app/.heroku/python/lib/python3.5/site-packages/django/core/management/__init__.py", line 367, in execute_from_command_line
    utility.execute()
  File "/app/.heroku/python/lib/python3.5/site-packages/django/core/management/__init__.py", line 359, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/app/.heroku/python/lib/python3.5/site-packages/django/core/management/base.py", line 294, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/app/.heroku/python/lib/python3.5/site-packages/django/contrib/auth/management/commands/createsuperuser.py", line 63, in execute
    return super(Command, self).execute(*args, **options)
  File "/app/.heroku/python/lib/python3.5/site-packages/django/core/management/base.py", line 345, in execute
    output = self.handle(*args, **options)
  File "/app/.heroku/python/lib/python3.5/site-packages/django/contrib/auth/management/commands/createsuperuser.py", line 96, in handle

issue on comment submit

Hi, after I created a comment I was trying to submit it but got the following error:

ValueError: Cannot assign "'user1'": "Post.author" must be a "User" instance. Shouldn't be user name detected from login somehow? Are you planning to extend the tutorial? Thank you!

This book doesn't build on Gitbook anymore

Maybe we need to upgrade book.json to 2.5.0? Needs testing locally.

Build error:

Downloading source
Extracting source
Installing GitBook 2.1.0
[email protected] ../tmp-40pX7E6h4npZcI/node_modules/gitbook
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] ([email protected], [email protected])
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] ([email protected], [email protected], [email protected], [email protected])
├── [email protected] ([email protected])
├── [email protected] ([email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected])
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] ([email protected], [email protected], [email protected], [email protected])
└── [email protected]
GitBook version is 2.1.0 
Tweaking book.json
Installing plugins
info: 2 plugins to install 
info: No version specified, resolve plugin comment 

Found no satisfactory version for plugin comment

settings.py error in "Deploy your website on Heroku" section

mysite/settings.py

import dj_database_url
DATABASES['default'] = dj_database_url.config()

SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')

ALLOWED_HOSTS = ['*']

DEBUG = False

try:
    from .local_settings import *
except ImportError:
    pass

I tried to deploy on heroku with above code, I got this error.

$ heroku logs
(omitted)
2017-07-21T18:55:02.766691+00:00 app[web.1]:   File "/app/register/settings.py", line 92, in <module>
2017-07-21T18:55:02.766691+00:00 app[web.1]:     DATABASES['default'] = dj_database_url.config()
2017-07-21T18:55:02.766694+00:00 app[web.1]: NameError: name 'DATABASES' is not defined
(omitted)

So I rewrite to below:
mysite/settings.py

try:
    from .local_settings import *
except ImportError:
    pass
import dj_database_url
DATABASES['default'] = dj_database_url.config()

SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')

ALLOWED_HOSTS = ['*']

DEBUG = False

this code passed. No error occurred.
So I think you need to fix code "settings.py" in "Deploy your website on Heroku.
Do you any other opinion? Because I'm beginner.

logging out

I'm not sure what I missed... when I click on logout it gives me an error,

Request Method: GET
http://127.0.0.1:8000/%7B%25%20url%20'logout'%20%25
Using the URLconf defined in mysite.urls, Django tried these URL patterns, in this order:
^admin/
^accounts/login/$ [name='login']
^accounts/logout/$ [name='logout']
^$ [name='post_list']
^post/(?P\d+)/$ [name='post_detail']
^post/new/$ [name='post_new']
^post/(?P\d+)/edit/$ [name='post_edit']
^post/(?P\d+)/publish/$ [name='post_publish']
^drafts/$ [name='post_draft_list']
^post/(?P\d+)/remove/$ [name='post_remove']
The current URL, {% url 'logout' %, didn't match any of these.

Did I miss doing something here that is not explained?

We decided to rely on Django to handle login, so let's see if Django can also handle logout for us. >Check https://docs.djangoproject.com/en/1.10/topics/auth/default/ and see if you find something.

Done reading? By now you may be thinking about adding a URL in mysite/urls.py pointing to >Django's logout view (i.e. django.contrib.auth.views.logout), like this:

Typographic error

In views.py, I get an error in the redirect phrase for post_publish.

I think that "pk=pk" should read "pk=post.pk" .
Unless I am missing something.

def post_publish(request, pk):
post = get_object_or_404(Post, pk=pk)
post.publish()
return redirect('post_detail', pk=pk)

greetings,
Rose

"post_new" method is mentioned but not available

Hi,
On following page, tutorial says we should change post_new and post_edit method in views.py. I have completed every step in tutorial. We didn't add any class to views.py, put aside any method... It is confusing...

https://djangogirls.gitbooks.io/django-girls-tutorial-extensions/homework/

Save new posts as drafts

Currently when we're creating new posts using our New post form the post is published directly. To instead save the post as a draft, remove this line in blog/views.py in the post_new and post_edit methods:

post.published_date = timezone.now()

Also

Delete post

Let's open blog/templates/blog/post_detail.html once again and add this line:


just under a line with the edit button.

We have never added edit button to post_detail page...

Two minor documentation bugs

  • In the 'Log in users' section, just before the first code snippet, "In your mysite/urls.py add a url url(r'^accounts/login/$', views.login). So the file should now look similar to this: " should be changed to "In your mysite/urls.py add a url url(r'^accounts/login/$', views.login, name='login'). So the file should now look similar to this:" ~ adding name='login' in the url statement

  • In the homework given in 'Improving the layout' section, it should be "delete and edit buttons" instead of "add and delete buttons", as we have already taken care of the add button in base.html as mentioned in the code snippet in the same section.

A error occurs in blog/urls.py

@h5jam commented on Sun Sep 08 2019

Issue description

When I add this code in my blog/urls.py, a error occurs.
I want to add the necessary module to the tutorial to make sure novices don't panic.
 

url(r'^drafts/$', views.post_draft_list, name='post_draft_list'),

Thank you.

https://tutorial-extensions.djangogirls.org/ko/homework/#%EA%B2%8C%EC%8B%9C%EB%90%98%EC%A7%80-%EC%95%8A%EC%9D%80-%EB%B8%94%EB%A1%9C%EA%B7%B8-%EA%B8%80-%EB%AA%A9%EB%A1%9D-%ED%8E%98%EC%9D%B4%EC%A7%80-%EB%A7%8C%EB%93%A4%EA%B8%B0

Language

KO

Operating system

Mac

can't import name 'CommentForm'

ImportError at /post/5/comment/
cannot import name 'CommentForm'
Request Method: GET
Request URL:    http://localhost:8000/post/5/comment/
Django Version: 1.8
Exception Type: ImportError
Exception Value:    
cannot import name 'CommentForm'
Exception Location: E:\pywork\djangogirls\blog\views.py in <module>, line 6
Python Executable:  E:\Python35\python.exe
Python Version: 3.5.0
Python Path:    
['E:\\pywork\\djangogirls',
 'E:\\Python35\\lib\\site-packages\\django_debug_toolbar-1.4-py3.5.egg',
 'E:\\Python35\\lib\\site-packages\\sqlparse-0.1.19-py3.5.egg',
 'E:\\Python35\\python35.zip',
 'E:\\Python35\\DLLs',
 'E:\\Python35\\lib',
 'E:\\Python35',
 'E:\\Python35\\lib\\site-packages']
Server time:    Thu, 16 Jun 2016 17:02:11 +0800

when I study this course
https://github.com/DjangoGirls/tutorial-extensions/blob/master/homework_create_more_models/README.md .
run this url

http://localhost:8000/post/5/comment/

I get this error.

can u help me to fix this?Thank u.

Issue at Improving the layout -

At the section of this tutorial it is mentioned that:
"So now we have made sure that only authorized users (ie. us) can add, edit or publish posts. But everyone still gets to view the buttons to add or edit posts. " However I believe that is not true, if you are not authorized you cannot see it because:

{% if user.is_authenticated %}


{% else %}

I tried and I do not see those buttons... can you please check that this is the intended behavior?

Best and congratulations this is the best tutorial I've seen on django!

Ana

Allauth-Tutorial

Hello. I'd like to see an allauth-tutorial. It's a rather big package with not very newbie friendly documentation.

Proposal: add a tutorial extension based on Wagtail

Hi 👋

I've been thinking about writing a beginner-level tutorial for Wagtail, a popular CMS based on Django. Would this be interesting as a new extension? I'm willing to make that happen but I would like to check first whether others think it makes sense.

It is very common for people to initially start a project with Django, then bring on Wagtail later on to manage their site's content – it comes with its own admin interface which is generally more user-friendly than Django's (I help build it so I'm biased), as well as features specific to content management. Here are my ideas for what could go in the extension:

  • Explaining what Wagtail is, what a CMS is, how this fits with Django.
  • Installing Wagtail in the existing project.
  • Creating a page model, reflecting on how this compares with Django.
  • Creating a contact form on the site (very easy).
  • Creating a basic image gallery? (Wagtail does lots around this so that's not much code).

I think those things would be a good mix of being interesting to do and also simple enough for the extension to not be too long, but I'll check with other Wagtail people if they have more ideas.

How does that sound?

'Post' object has no attribute 'publish'

I get the following error when I click on the "Publish" button. I think the alignment in my post_detail.html file may be off and causing the problem. Is the source code listed somewhere?

AttributeError at /post/4/publish/
'Post' object has no attribute 'publish'
Request Method: GET
Request URL: http://127.0.0.1:8000/post/4/publish/
Django Version: 1.9.4
Exception Type: AttributeError
Exception Value:
'Post' object has no attribute 'publish'
Exception Location: /home/kevin/djangogirls/blog/views.py in post_publish, line 56
Python Executable: /usr/bin/python
Python Version: 2.7.11
Python Path:
['/home/kevin/djangogirls',
'/usr/local/lib/python2.7/dist-packages/setuptools-20.2.2-py2.7.egg',
'/usr/lib/python2.7/dist-packages',
'/usr/local/lib/python2.7/dist-packages/lgogd_uri-0.1.0.1-py2.7.egg',
'/usr/lib/python2.7',
'/usr/lib/python2.7/plat-x86_64-linux-gnu',
'/usr/lib/python2.7/lib-tk',
'/usr/lib/python2.7/lib-old',
'/usr/lib/python2.7/lib-dynload',
'/home/kevin/.local/lib/python2.7/site-packages',
'/usr/local/lib/python2.7/dist-packages',
'/usr/lib/python2.7/dist-packages/PILcompat',
'/usr/lib/python2.7/dist-packages/gtk-2.0',
'/usr/lib/python2.7/dist-packages/wx-3.0-gtk2']

Postgres extension problems on Linux

There are some problems with the postgres tutorial extension when run on Linux:

  1. There are a few packages that are required for the psycopg2 install to work:
  • postgresql-server-dev-X.Y (version may vary - on Ubuntu 16.04 it is 9.5)
  • gcc
  • libpython3.5-dev
  1. The default auth setup doesn't work. (Ref #59) - first of all, the default user can't open psql and create a database, that needs to be done by postgres user (so they must sudo). I don't know if this is something that just works on Mac or Windows?

  2. Authenticating a named (non-unix) user over the tcp socket requires a password, however the settings in the tutorial extension don't use a password (and the user is never given one). This was discussed in #59 - there are various options for this:

  • Get them to use their unix username, but that may require separate settings across different machines.
  • Get them to create the db user with a password, and include the password in settings. Probably the least complex and applicable to all platforms but would require careful pointing out of it being probably OK to include the password in this case, but making sure they're aware of it not generally being a good idea :)
  • Editing postgres config to trust local connections. It's a small edit but involves acting as root, changing a config file (probably making sure it gets backed up just in case) and restarting the postgres server.

Again, I don't know whether all this "just works" on windows and mac.

Interested in other opinions about what is the best way to deal with this!

Japanese translation

Hello. I am Kazuki, a coach of Django Girls Tokyo.
I would like to propose a merge for this pull request #123 .
As we have requested the merge last March #123, it has not been merged yet. Is there any problems?

The women (and men) who have finished the Django Girls Tutorial are going to try this extensions next.
Many people also need a Japanese translation.

This pull request #123 has been reviewed by Japanese people and I think it deserves what many people want.
Do you have any problems or concerns about merging?
If there is, I am willing to cooperate.

I am looking forward to it being merged.

Secure your website - superfluous homework and typos

I. Section Improving the layout - homework:

Edit the template blog/templates/blog/post_detail.html to only show the edit buttons for authenticated users

is superfluous, as it was already done in the basic DjangoGirls tutorial (http://tutorial.djangogirls.org/en/django_forms/#security last code snippet)

II. A typo in Login users second passage
is:

In your mysite/urls.py add a url url(r'^accounts/login/$', django.contrib.auth.views.login).

should be:

In your mysite/urls.py add a url url(r'^accounts/login/$', django.contrib.auth.views.login, name='login').

III. A typo in the second code snippet for More on authenticated users

is: include django.contrib.auth.views

should be: import django.contrib.auth.views

Typo in Url in Section "Add publish button"

Hey, I think in the "Add publish button" section the url should read blog/templates/blog/post_detail.html, that is, with templateS in plural, instead of singular as it is now..

broken links at https://djangogirls.gitbooks.io/django-girls-tutorial-extensions/content/en/

@login_required is not defined

Hi, after I add @login_required to functions comment_approve and comment_remove in views.py, I'm getting nameError in the CMD saying "login_required" is not defined.

Section1: Incorrect HTML for Draft button

In the first Homework. The single/double quote nesting is incorrect. The HTML to insert is given as:

<a href="{% url "post_draft_list" %}" class="top-menu"><span class="glyphicon glyphicon-edit"></span></a>

It should be:

<a href="{% url 'post_draft_list' %}" class="top-menu"><span class="glyphicon glyphicon-edit"></span></a>

Also it should follow the link for the post_new, rather than be just above the <h1><a href="/">Django Girls Blog</a></h1> line, so that it will only display for an authorized user.

include(admin.site.urls) is changed in Django 1.10

include function is not needed in Django 1.10 in url.py

https://djangogirls.gitbooks.io/django-girls-tutorial-extensions/authentication_authorization/

urlpatterns = [
url(r'^admin/', include(admin.site.urls)),]

https://docs.djangoproject.com/en/1.10/ref/contrib/admin/

urls.py

from django.conf.urls import url
from django.contrib import admin

urlpatterns = [
url(r'^admin/', admin.site.urls),
]
Changed in Django 1.9:
In previous versions, you would pass admin.site.urls to include().

approved_comment count

For some reason I cannot seem to get the approved_comments count to work. The regular comment count works.

I copied and pasted the snippet into the models.py and post_list.html to ensure I didn't have a typo.

My post_list.html Just shows "Comments:". Is this just me?

"Your first PR" tutorial

It would be really cool to create a tutorial extension to help attendees fix typo in the tutorial. I'll start working on that ASAP.

Problems with urls.py in 'Homework: create comment model' chapter

The tutorial says to add this pattern:

url(r'^post/(?P<pk>\d+)/comment/$', views.add_comment_to_post, name='add_comment_to_post'),

(1) It is not mentioned that you need to add the following import statement: from blog import views
(2) this assumes that the student hasn't completed the previous chapter, where they import import django.contrib.auth.views. (I suggested that my student amend this to import django.contrib.auth.views as djangoviews to avoid the conflict.)

comments count

comments count on post_list page is not working. When changing it to show only count of approved comments on post_list page it shows "Comments: ".

unclosed small tag

in div class="page-header" the small tag does not have it's closing counterpart

Check links in README.md

The first page of the book as well as the README.md 404s on the Contribute link.

Also in the book, the links for the 4 sections link to the GitHub repo instead of GitBook page.

Add publish button

I'm following the instructions and I get an error when I click on publish button

`Request Method: GET
http://127.0.0.1:8000/post/6/publish/
1.10.7
AttributeError
'Post' object has no attribute 'publish'
/Users/nahusznaj/djangogirls/blog/views.py in post_publish, line 47
/Users/nahusznaj/djangogirls/myvenv/bin/python
3.5.1
['/Users/nahusznaj/djangogirls', '/Library/Frameworks/Python.framework/Versions/3.5/lib/python35.zip', '/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5', '/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/plat-darwin', '/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/lib-dynload', '/Users/nahusznaj/djangogirls/myvenv/lib/python3.5/site-packages']
Mon, 7 Aug 2017 10:23:35 +0100
`

This is my line 47 in views.py

def post_publish(request, pk): post = get_object_or_404(Post, pk=pk) post.publish() return redirect('post_detail', pk=pk)

what's wrong?

Security chapter: url tag in link to post list

In the "secure your website" chapter, the h1 tag in the base template is shown as follows:

<h1><a href="{% url 'blog.views.post_list' %}">Django Girls</a></h1>

Which needs updating to use the url name rather than the view path.

But the markup from the tutorial just has <a href="/">

I guess using the url tag is better but it should be made consistent (and correct) one way or another

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.