Comments (3)
I would to like to help on this issue , please provide me more information so I can solve it .
from bakerydemo.
Hi, I have made a rough sketch of the steps needed to complete this task. Points taken from https://docs.wagtail.org/en/stable/reference/contrib/settings.html. If its valid can I do a PR and add these changes?
We create a new app within the bakerydemo project using python manage.py startapp mysettings
Add it to the INSTALLED_APPS
setting -
INSTALLED_APPS = [
...
'mysettings',
...
]
Now, create a models.py
file in the mysettings
app directory and import the BaseSiteSettings
model from wagtail.contrib.settings.models
from wagtail.contrib.settings.models import BaseSiteSettings
class MySiteSettings(BaseSiteSettings):
footer_text = models.CharField(
verbose_name='Footer text',
max_length=255,
null=True,
blank=True,
)
panels = BaseSiteSettings.panels + [
FieldPanel('footer_text'),
]
class Meta:
verbose_name = 'Site settings'
verbose_name_plural = 'Site settings'
Here, I've made MySiteSettings model that extends the BaseSiteSettings
model and adds a footer_text
field. It also have new panels
attribute that includes the footer_text
field in the admin interface.
Now, to use the new Site Settings, register it with Wagtail wagtail_hooks.py
file
from wagtail.contrib.modeladmin.options import ModelAdmin, modeladmin_register
from .models import MySiteSettings
class MySiteSettingsAdmin(ModelAdmin):
model = MySiteSettings
menu_label = 'Site settings'
modeladmin_register(MySiteSettingsAdmin)
I have extended the ModelAdmin class and set the model attribute to the new setting
Finally run the make migration
codes as usual
For site-wide settings, change this in settings.py
, so the new settings model is used - WAGTAIL_SITE_SETTINGS_MODEL = 'mysettings.MySiteSettings'
For using BaseGenericSetting as logo, we create a new model that inherits from BaseGenericSetting
to represent the logo, and then register it with Wagtail in your app's wagtail_hooks.py
file.
from bakerydemo.
Hey @Hanoon02 thanks for this, I realised that the bakery demo site already has a footer model. It's a snippet.
Maybe the site setting could be a simple title suffix (that can be translated), one single char field.
This could then be used here https://github.com/wagtail/bakerydemo/blob/main/bakerydemo/templates/base.html#L15
A second field this model could be a colour field and then this sets the theme colour meta tag. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta/name/theme-color
Also, I don't think we would need a new app for this, in the base app is fine. Another thing that will need to be in the PR is the fixtures data.
from bakerydemo.
Related Issues (20)
- Problem with iframe dimensions in paragraph blocks in Streamfields.
- Replace flake8 and isort with ruff HOT 1
- CSP testing setup HOT 9
- Create separate `dev` branch for Wagtail development purposes HOT 2
- modelcluster. ValueError : invalid literal for int() with base 10: 'THU' on locations pages in the admin preview HOT 1
- Inaccurate copyright message in footer HOT 1
- Documents in demo site HOT 1
- Replace ModelAdmin usage with snippets
- MultipleChooserPanel example
- Issues with loading initial data (SearchPromotion)
- Create (or change) a model to use UUID/non-integer for its primary key HOT 2
- Help text of featured sections in homepage repeats the same as in Promo title
- Guys, it uses so old packages. and gives error. I recommend don't use this demo. HOT 1
- Images in all of Wagtail’s supported formats
- Enable `USE_THOUSANDS_SEPARATOR` by default & have some larger test ids HOT 3
- Update Node/NPM libraries (Node 20)
- AttributeError: module 'dotenv' has no attribute 'read_dotenv'. Did you mean: 'load_dotenv'? HOT 3
- exec /code/docker-entrypoint.sh: no such file or directory HOT 2
- migration failed HOT 1
- Fresh install of the bakerydemo using pyenv generates 'KeyError at / <wagtail.images.models.Filter object at 0x10953ef40>' HOT 11
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bakerydemo.