Questions tagged [django-sites]

django-sites is a framework for associating objects and functionality to particular Web sites. Is used when a single Django instance power more than one site.

django-sites is a framework for associating objects and functionality to particular Web sites. Is used when a single Django instance power more than one site.

119 questions
1
vote
1 answer

Django incorrect import

I am developing a web app with django 1.2.4, but I am having a problem with the Site model. I try: from django.contrib.sites.models import Site ... if Site._meta.installed: ... I am getting the error undefined variable from import: _meta in the…
juankysmith
  • 11,839
  • 5
  • 37
  • 62
1
vote
1 answer

Django: How to hide Sites framework from Django Admin while using django-allauth?

Background I have a django server that uses django-allauth for handling authentication logic. I want to unregister Sites framework from django-admin, in other words, I do not want to see the Sites section inside django-admin: What I tried Normally,…
Beki
  • 1,344
  • 1
  • 12
  • 22
1
vote
1 answer

Django sitemap.xml. Why I am getting example.com in the file?

I generate sitemap.xml on the development server, but instead of 127.0.0.1 I get example.com in he URL. I have nowhere in the code reference to example.com. - - http://example.com/xxxx/ABCDE/ - - What…
cegthgtlhj
  • 191
  • 1
  • 8
1
vote
1 answer

Django CMS Link - AttributeError 'Page' object has no attribute 'site'

I am able to add link through djagnocms_link. But when I double click on that link for edit It throws me this error - [AttributeError 'Page' object has no attribute 'site'] inside ckeditor. And interestingly it's only happens when I try to add link…
1
vote
0 answers

Django: detecting request domain in urls.py

I have a Django app that will serve diferent websites. Each one will have it´s own domain Each one will have it´s own sub app with templates and views They all share the same backend, models and data My aproach As I already have the database with…
Francisco Ghelfi
  • 872
  • 1
  • 11
  • 34
1
vote
1 answer

Add current site's domain to template dirs

What is the correct way to prepend an extra, site-specific templates directory to the template dirs setting in Django? TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [
bodger
  • 1,112
  • 6
  • 24
1
vote
0 answers

Django sites framework without SITE_ID

Are there any advantages/disadvantages to using SITE_ID in order to manage the sites framework in Django - as opposed to just relying on the hostname and allowing Django to "work out" the site based on that? I need to provide multiple sites off the…
bodger
  • 1,112
  • 6
  • 24
1
vote
1 answer

How sites framework works?

I am trying to develop a ModelManager with an operation similar to the Sites Framework. Depending on a user's field, the ModelManager returns a queryset. I tried to imitate the operation of the Sites Framework but I do not understand how the SITE_ID…
paralosreg
  • 141
  • 1
  • 15
1
vote
1 answer

Migration file don't change Site name and domain

I have this migration file: from django.db import migrations from django.contrib.sites.models import Site as DjangoSite def change_django_site(apps, schema_editor): site = DjangoSite.objects.get(id=1) site.delete() …
SalahAdDin
  • 2,023
  • 25
  • 51
1
vote
0 answers

Can't make messages with Django's JavascriptCatalogView

I use Djnago with sites framework. The static root has the following structure: css js site1.bundle.js site2.bundle.js site3.bundle.js When I try to make messages (python manage.py makemessages -d djangojs -a) the command above extracts…
Yurii Rabeshko
  • 591
  • 8
  • 17
1
vote
1 answer

Only allow django admin on site id 1

I want to only show the admin for my site with id 1. In other views I've defined this in the dispatch, but I haven't found a way to do this for the admin. I tried making a custom admin class, but I didn't see a way to do this either. Is there a way…
gdvalderrama
  • 713
  • 1
  • 17
  • 26
1
vote
1 answer

Is there a way to add a ForeignKey to the Site model in Django Sites Framework?

This answer shows the inverse of what I'm looking for because it allows one Site to have many Asset objects: # Note: This is not my code. This is opposite of what I want. # I want the ForeignKey on the Site object. from django.contrib.sites.models…
YPCrumble
  • 26,610
  • 23
  • 107
  • 172
1
vote
1 answer

How can I use the current Site as the default in a Django form using the Sites Framework?

I'm using the Sites Framework and want to save the current site as the default site value for one of my models. Model: class MyModel(models.Model): site = models.ForeignKey( Site, on_delete=models.CASCADE, …
YPCrumble
  • 26,610
  • 23
  • 107
  • 172
1
vote
1 answer

Keep user logged in accross Sites

I'm using Django Sites framework to hadle different sites. They have different domains but same database and same users. I'd like to add a link to switch between my sites. The thing is I don't want to get redirected to login form. What is the best…
pisapapiros
  • 355
  • 1
  • 2
  • 12
1
vote
1 answer

Django settings - customize attributes per Site from admin

I'm using django sites framework. I've a model with a OneToOneField to Site model. This way the admin users can customize each site attributes from the admin panel. class CustomSite(models.Model): site = models.OneToOneField(Site) …
pisapapiros
  • 355
  • 1
  • 2
  • 12