GithubHelp home page GithubHelp logo

djangocms-alias's Introduction

django CMS

Code Climate

Open source enterprise content management system based on the Django framework and backed by the non-profit django CMS Association (Sponsor us!).

Contribute to this project and win rewards

Because django CMS is a community-driven project, we welcome everyone to get involved in the project. Become part of a fantastic community and help us make django CMS the best open source CMS in the world.

Attention!

Please use the develop-4 branch as the target for pull requests for on-going development.

Security fixes will be backported to older branches by the core team as appropriate.

Features

  • hierarchical pages
  • extensive built-in support for multilingual websites
  • multi-site support
  • draft/publish workflows
  • version control
  • a sophisticated publishing architecture, that's also usable in your own applications
  • frontend content editing
  • a hierarchical content structure for nested plugins
  • an extensible navigation system that your own applications can hook into
  • SEO-friendly URLs
  • designed to integrate thoroughly into other applications

Developing applications that integrate with and take advantage of django CMS features is easy and well-documented.

More information on our website.

Requirements

See the Python/Django requirements for the current release version in our documentation.

See the installation how-to guide for an overview of some other requirements and dependencies of the current release.

Getting started

These tutorials take you step-by-step through some key aspects of django CMS.

Documentation

Our documentation working group maintains documentation for several versions of the project. Key versions are:

  • stable (default), for the current release version
  • latest, representing the latest build of the develop-4 branch

For more information about our branch policy, see Branches.

Our documentation is hosted courtesy of Read the Docs.

The dependencies for the docs are compiled by pip-tools.

Test django CMS in our demo

The demo platform is kindly provided by Divio, platinum member of the django CMS Association.

Try demo with Divio Cloud

Getting Help

Please head over to our Discord Server or Stackoverflow for support.

Professional support

Choose from a list of trusted tech partner of the django CMS Association to get your website project delivered successfully.

Choose a trusted web host for your django CMS project and get your website online today.

The django CMS Association

The django CMS Association is a non-profit organization that was founded in 2020 with the goal to drive the success of django CMS, by increasing customer happiness, market share and open-source contributions. We provide infrastructure and guidance for the django CMS project.

The non-profit django CMS Association is dependent on donations to fulfill its purpose. The best way to donate is to become a member of the association and pay membership fees. The funding will be funneled back into core development and community projects.

Join the django CMS Association.

Credits

djangocms-alias's People

Contributors

aacimov avatar adam-murray avatar aiky30 avatar albanbochsler avatar bernardvdv avatar chaosk avatar czpython avatar dependabot[bot] avatar evildmp avatar finalangel avatar fsbraun avatar fscherf avatar jonathan-s avatar lgtm-com[bot] avatar marksweb avatar michaeljcollinsuk avatar mmoravcik avatar narenderrajub avatar pre-commit-ci[bot] avatar raffaellasuardini avatar stefanw avatar transifex-integration[bot] avatar vasekch avatar vthaian avatar vxsx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

djangocms-alias's Issues

Pre-commit bot breaks tests

The precommit bot automatically adds a newline to all HTML templates. This breaks the tests.

templates/djangocms_alias/default/alias.html must not have a newline at the end.

Add more info what package does

Hi there,

Just found out that package in GitHub newsletter about new package but there is no description what package does :)

Usability improvements

Since djangocms-alias will become more important for django CMS V4 as it replaces static placeholders, I'd love to request a few usability improvements.

Creating an alias

  • Using the wizard is the only way to create an alias (#97)
  • Creating an alias through the wizard leaves it unclear what language the alias will have
  • Offer a way to add a translation within the admin - currently I only see the language menu as a way to add an AliasContent which is only available if you edit a draft of another language
  • The language menu offers to copy plugins from the same translation many times - probably an effect which is due to versioning of aliases (and versioning seems to provide its own language menu)

Editing

  • Arriving in editing an alias takes many clicks. Suggestions:
    • Allow front end editing of an alias inserted by {% static_alias "xyz" %} through double click
    • Add link to Alias plugin admin form to edit the content of the alias
  • Integrate alias editing into the admin (if this is at all possible): The current editing of an alias outside the admin interface is somewhat counter intuitive for django CMS standards. Also, it does not allow to return to the page from which it was called. Options might include
    • Have the alias placeholders visible in the structure tree similar to static placeholders in v3 (which might raise a problem with versioning)
    • Open the edit page in a pop-up window similar to filer (ideally triggering a reload of parent window after finishing editing)
    • At the minimum include a back link on the edit page to be able to resume work after having edited an alias

Documentation

  • Add basic documentation in README.rst

Sorry for raising some issues and not providing solutions here.

[feat] Name placeholder of static alias like the static alias

This issue has been raised by Tow Cowan on Slack and @petrklus:

I used static_placeholder to allow site-wide content to be edited, and could control the plugins used in this with the CMS_PLACEHOLDER_CONF setting. I’m now using v4 for a new project - am I able to do something similar with the static_alias tag? I don’t seem to be able to do so with the configuration I’ve tried.
For example, if I have the following in my base.html template (outside of any blocks):

{% static_alias 'banner' %}

And then the following in my settings:

CMS_PLACEHOLDER_CONF = {
	"banner": {
		"plugins": ["BannerPlugin"],
	},
}

When I view the Alias (Django Admin -> Django CMS Alias -> Aliases -> Preview) and then try to add a plugin, it ignores the above placeholder config. If I add a key for a “content” placeholder in CMS_PLACEHOLDER_CONF it does allow me to configure the available plugins, but this would mean that all of my static_alias tags would have the same configuration.

Integrate with content expiry

def content_expiry_site_alias_excluded_set(site, queryset):
    """
    Filter ContentExpiry records to show only Alias objects available on a given site.
    Model structure: Expiry->Version->Content->Alias->site

    :param site: A site object to query against
    :param queryset: A queryset object of ContentExpiry records
    :return: A filtered list of Content Expiry records minus any none site PageContent models
    """
      from djangocms_alias.models import AliasContent

      alias_queryset = AliasContent._original_manager.exclude(Q(alias__site=site) | Q(alias__site__isnull=True))
      alias_queryset.select_related('alias')


      alias_content_ctype = ContentType.objects.get_for_model(AliasContent)
      site_alias_contents = get_alias_content_site_objects(site)
      queryset = queryset.exclude(
          version__content_type=alias_content_ctype, version__object_id__in=site_alias_contents
      )

    return queryset

djangocms_content_expiry_changelist_queryset_filters = [
    content_expiry_site_alias_excluded_set
]

Sync pre-commit checks with django-cms

I've made changes over the weekend to the pre-commit hooks in django-cms.

Ideally we'll have these consistent between projects. The main thing in the change is adopting the ruff linter and formatter.

In theory you should be able to just copy & paste the config from django-cms into these other projects;

https://github.com/django-cms/django-cms/blob/develop-4/.pre-commit-config.yml

The way ruff works is dictated by the pyproject.toml config which you can see here;

https://github.com/django-cms/django-cms/blob/develop-4/pyproject.toml

This project has one already, so this isn't as much a copy & paste job. The main thing is to have the same things in the select block.

Then in django-cms you'll see it uses extend-ignore and extend-exclude. So where projects like this on have exclude and ignore, we want to update these to the extend- versions.

Then you'll see a # TODO fix separately block. Create one of these that includes all the checks that currently fail. These can be fixed in smaller PRs.

To make sure you can run ruff, it's a python package. So in your virtual env run python -m pip install ruff

Also make sure you have pre-commit setup;

python -m pip install pre-commit
pre-commit install

Now any commits you make will get checked by the project's hooks. And if you add more, you just run the pre-commit install again.

Now you can run ruff using ruff check .

This will run the defined checks against the current directory. It's at this point you need to make judgements on if it's running on any directories that you could exclude because it's not part of the project. And then start adding to that # TODO list of rules.

Hopefully that's enough info to get started, but let me know if you've any questions. And of course, you can query things on slack as well. Maybe using the contributors channel for things realted to these changes.

Language issue

Looks like the recently language changes have left a null value in a non-null field.

NotNullViolation: null value in column "language" violates not-null constraint
DETAIL:  Failing row contains (55, my_alias, null, 1).

  File "django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
IntegrityError: null value in column "language" violates not-null constraint
DETAIL:  Failing row contains (55, my_alias, null, 1).

And the insert triggering this is;

INSERT INTO "djangocms_alias_aliascontent" ("alias_id", "name", "language") VALUES (%s, %s, %s) RETURNING "djangocms_alias_aliascontent"."id"

The issue which these changes addressed is #162

Doesnt autocreate aliases for other languages than LANGUAGE_CODE

My languages are 'nl' (primary) and 'en'. When click at aliases in the site dropdown from the cms_toolbar, i auto create a 'footer' alias for that language (nl) because LANGUAGE_CODE='nl'. Ik can edit en publish and such with thie alias editor.

Point is, when i switch to /en/pages i also click on 'aliases...' but it says no aliases registered.

Python 3.10
Django==3.2
Django-cms==4.1..0rc1

GrouperModelAdmin issues: ModuleNotFoundError: No module named 'cms.admin.utils'

Hi

I've just re-synced my virtualenv that's pulling in master of this component.

Noticed in this github you've pushed something 1 hour ago to do with GrouperAdmin

I'm now getting this when starting my application:

Traceback (most recent call last):
  File "/Users/ahayes/Sites/consoles/.venv/lib/python3.9/site-packages/django/apps/registry.py", line 122, in populate
    app_config.ready()
  File "/Users/ahayes/Sites/consoles/.venv/lib/python3.9/site-packages/django/contrib/admin/apps.py", line 27, in ready
    self.module.autodiscover()
  File "/Users/ahayes/Sites/consoles/.venv/lib/python3.9/site-packages/django/contrib/admin/__init__.py", line 24, in autodiscover
    autodiscover_modules('admin', register_to=site)
  File "/Users/ahayes/Sites/consoles/.venv/lib/python3.9/site-packages/django/utils/module_loading.py", line 47, in autodiscover_modules
    import_module('%s.%s' % (app_config.name, module_to_search))
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/Users/ahayes/Sites/consoles/.venv/src/djangocms-alias/djangocms_alias/admin.py", line 12, in <module>
    from cms.admin.utils import GrouperModelAdmin
ModuleNotFoundError: No module named 'cms.admin.utils'

...my requirements.txt lists django-cms==4.1.0rc1 as the CMS version in the requirements, which is higher than the version listed in setup.py of this component.

...am I doing something wrong?

Pinning to the previous release in the interim

`static_alias` renders only if you have a block named "content"

I am not sure if this should be a feature request but I usually have a block named base_content instead of content since I sometimes have a different base.html file for different purposes.

static_alias can be edited only if a block named content exists in the template. I suppose it's by design and by best practices but just a thought.

I was struggling for a few minutes why I cannot edit my static_alias so maybe it will be helpful to others.

Or just adding a note to the docs as an indicator it is actually a dependency in the template.

Python 3.10.6
Django 4.2.9
Django CMS 4.1.0
djangocms-alias 2.0.0

`Alias` and `AliasContent` objects should not have `get_absoulte_url` methods

Bug: Edit alias context menu of alias plugin

When no alias content object for the current language exists, the "Edit alias" menu entry redirects to something like admin/cms/placeholder/object/5/edit/3/None.

Code inspection shows that the context menu uses the get_absolute_url method of the Alias object.

Way forward

According to the Django docs, get_absolute_url should calculate the canonical URL of an object. I argue that aliases should not have a canonical URL, since

  • they represent fragments which are not to be offered to the end user independently
  • all URL returned by the current implementation refer to admin sites which - by definition - are unreachable for non-staff users.
  • the "View on site" link in the admin's object tools

I propose to

  • Remove the methods from both Alias and AliasContent
  • Replace the "Edit alias..." plugin context menu URL (now the "canonical" URL) with a real edit URL
  • Replace the admin object tools "View on site..." by "View content..."

Thanks to @vasekch for pointing this out on slack.

Readme file needs updating. Installation doesn't work.

New project. Installed Alias in the usual way... just doesn't work. Can't add Aliases. Can't add categories.

TemplateDoesNotExist at /en/admin/djangocms_alias/category/add/
admin/parler/change_form.html
AttributeError at /en/admin/djangocms_alias/aliascontent/add/
'NoneType' object has no attribute 'category'

[FEAT] django-cms 4 with alias module -> prefer alias edit mode in layout and not in front of black page

Description

I've tested djagno-cms 4 with djangocms-alias and djangocms-versioning.
When edit an alias this is not in the layout but in a blank page.

I've talked about this with @fsbraun and not sure if this is a feature or bug.

-> Django cms 4
-> Djangocms-versioning
-> Djangocms-alias

  • Yes, I want to help fix this issue and I will join #workgroup-pr-review on Slack to confirm with the community that a PR is welcome.
  • No, I only want to report the issue.

alias autocreation doesnt add SITE_ID?

When djangocms-alias autocreated the aliasses it leaves SITE field empty.
Is is possible to auto set it with SITE_ID?

If you want to add the same alias in a cms page with CMSplugin it doesnt find it because SITE is empty...?

Or is there a reason for?

djangocms-versioning draft deletion causes plugins to disappear from pages

When I use djangocms-alias with djangocms-versioning and I delete a draft of an alias, the alias does not get reset to the previous version on the pages using it. Instead, it gets removed entirely from all pages.

Steps to reproduce:

  1. Create a Page and publish it
  2. Create a Content Alias on that page and publish it
  3. Create a new draft for the Content Alias
  4. Delete the draft

I think the problem is rooted in this line in models.AliasContent.delete. From the code, it looks like this is wanted behavior because it deliberately deletes all plugins using the deleted Alias Content. Hence I am not sure how to fix it (just removing it works for me).

I use django-cms 4.1, and I was able to reproduces this behavior in all djangocms-alias versions I tried, including the latest master.

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.