django registration redux ignoring changes in templates - python

I've been struggling with Django registration redux over the past two weeks. I'm using the templates that were provided in the documentation and I've made a couple of changes like adding crispy forms and changing the button and some other stuff but the problem is that none of these changes are being shown on http://127.0.0.1:8000/accounts/register or any other link.
I'm using Django registration redux 1.4, Django 1.8, python 2.7.10

Putting your customized templates in templates/registration (not register) should work.
At least if your TEMPLATES setting is correctly configured: https://docs.djangoproject.com/en/1.8/ref/templates/upgrading/
And you probably already checked this hint from the project's FAQ?
I want to use custom templates, but django keeps using the admin
templates instead of mine!
To fix this, make sure that in the INSTALLED_APPS of your settings.py
the entry for the registration app is placed above
django.contrib.admin.

Related

Django urls. Why aren't urls.py included with new app?

Just curious, especially since Django is all about the DRY principle, why doesn't it include urls.py with creation of new app?
Maybe it's just my case(I'm relatively new to Django), but at least 90% of the time, I need to create a urls.py file, which seems quite repetitive to me. There are other actions while doing a web project/app that I've found repetitive, but the URLs seems fundamental to the structure, so don't see what the harm would be for it to be included with the new app creation.
Any thoughts, insights?
This is default startapp template behavior that Django team decided it is minimal ( not everyone would create urls.py in each app)
You can customize this behavior by providing your own app_template that suits your needs
From startapp documentation:
django-admin startapp --template=/Users/jezdez/Code/my_app_template myapp

Extend Django Admin Tools template

Is there a way I can override the brand block of django-admin-tools, which extends from Django's admin app?
If there is, how?
I tried placing base_site.html in one of the templates folders of my project, but Django is not picking it up, assumably because django-admin-tools has priority over the other templates because of the order of the apps in my settings. But if I change the order, django-admin-tools stops working as it's required to be at the top in my settings.

How to add page templates to Wagtail after installing into an existing Django application

I'm trying to extend an already existing Django App. The app is functioning fine as is, but I would like to add blog functionality.
I've installed Wagtail, using the guidelines here (http://docs.wagtail.io/en/latest/getting_started/integrating_into_django.html) To check wagtail is installed, I have navigated to here:
http://myurl/cms
And the wagtail admin panel is displayed. When I navigate to http://myurl/admin I get the default admin control panel for my Django app, so far so good.
Now I am trying to build the blog.
I found this tutorial:
http://wiseodd.github.io/techblog/2015/06/22/developing-wagtail/
which suggests the following as a first step: -
First, we’ll create our generic page class as home page class is
already created by default when we started Wagtail project.
It then displays this code:
# core/models.py
from wagtail.wagtailcore.models import Page
from wagtail.wagtailcore.fields import RichTextField
from wagtail.wagtailadmin.edit_handlers import FieldPanel
from wagtail.wagtailsearch import index
# We’re deriving our GenericPage from Page class, so that our GenericPage also has Page’s field, e.g. title
class GenericPage(Page):
# Let’s create our custom field, named body which is a rich text
body = RichTextField()
# Index the body field, so that it will be searchable
search_fields = Page.search_fields + (index.SearchField(‘body'),) # To show our body field in admin panel, we have to wrap it with FieldPanel and add it to Page’s field panel content_panels = Page.content_panels + [FieldPanel('body', classname=‘full’)]
I could not find which file I was meant to add this into. I searched the system using grep, and found a number of files that had the text string:
from wagtail.wagtailcore.models import Page
I decided the most likely candidate was in the directory:
env/lib/python2.7/site-packages/wagtail/project_template
Within my original app directory. I added the code above to the models.py file residing in the above directory. I then ran
python manage.py makemigrations
But it said no migrations were found. The next step in the tutorial posted above suggests you should now see three different page types available to create in the control panel, but I can not find the option to create any pages.
Can you tell me if I edited the correct file above, or if I should have edited a different file, and also
Why I am not seeing any option to add a new page in the wagtail control panel?
I have consulted with the documentation here (http://docs.wagtail.io/en/latest/getting_started/tutorial.html) and tried following the 'extend the homepage model' section, but couldn't figure out where the home/models.py file is as there is no folder called home in my Django app.
Thanks for any advice
As the final section of the "integrating into Django" docs says:
You’re now ready to add a new app to your Django project (via ./manage.py startapp - remember to add it to INSTALLED_APPS) and set up page models
Running ./manage.py startapp blog will add a blog app to your project, including an empty models.py - this is where you add your page definitions. (The Wagtail docs don't go into detail on this, because it's just following the standard Django workflow, which is hopefully familiar to anyone with an existing Django project to integrate with...)
Tutorials that use wagtail start my_project as a starting point will omit this step, because the starter project comes with a pre-made models.py with a HomePage model. The site-packages/wagtail/project_template directory you found is actually the 'master' copy of the starter project, which gets cloned at the point that you run wagtail start my_project. Since this isn't hooked up to your current project, changing it had no effect.

how to break down the admin app in django.contrib.auth to understand its working

I have been working with django for nearly 3 months and have been customizingadmin templates only. If I wanted to add any elements like buttons or some charts I extend the base.html, and then serve the extending template with another view inside my app(say Blog). But I want to customize my admin as much as possible but don't know how to do it. I have read the docs and it just gives snippets.
So to summarize, I want to create the admin site for my own blog right from scratch to understand the admin app in the contrib package in more detail.

Django: Add my own form to the admin backend?

I'm using the Django Admin module. It displays a list of models to edit by app. I would like to add another form to this list. It won't edit a specific model, but it will edit settings that are stored in the database. Is this possible?
You may check out Django Live Settings. It was split out of the Satchmo project and looks to do what you're looking for.
Otherwise, you may look into Overriding the Django Admin Templates. You could just override the index template and add your links to the bottom.

Categories

Resources