Comments (11)
Man, why put you a JET_INDEX_DASHBOARD if django-jet doesn't charge a custom dashboard by default? It's crazy. I think that this are a bug mine, but isn't it, it's a Django-Jet Bug
👍
from django-jet.
HI, this bug is a pain for me too,
Reset button ?
sql Command for reset on sqlite3 would be nice,
Thanks
from django-jet.
I am also facing exactly the same issue since many months.
from django-jet.
This is made mainly for storing widget's settings (title, some settings). What changes you do to dashboard file you don't want to be loaded from database?
from django-jet.
I need a multi-level dashboard so i am extending jet and making it hierarchial. So i would prefer loading it from file. Also in development its difficult to add more module and check because this function create new entry in database only when module_models is'nt there or its length is 0.
from django-jet.
@f1nality what's about this man?
I think that a possible solution will be use the same methos with this form:
class ResetDashboardForm(forms.Form):
app_label = forms.CharField(required=False)
def __init__(self, request, *args, **kwargs):
self.request = request
super(ResetDashboardForm, self).__init__(*args, **kwargs)
class Meta:
model = UserDashboardModule
fields = []
def clean(self):
data = super(ResetDashboardForm, self).clean()
data['app_label'] = data['app_label'] if data['app_label'] else None
if not self.request.user.is_authenticated():
raise ValidationError('error')
return data
def save(self, commit=True):
if commit:
UserDashboardModule.objects.filter(
user=self.request.user.pk,
app_label=self.cleaned_data['app_label']
).delete()
Use some this methods when load the custom template.
I think that when you use migrate on dashboard you load first default dashboard and it is set in database first. So, when you use reset, this function clean default dashboard sets in database and save the new dashboard, right?
from django-jet.
@Ajeetlakhani what do you mean by pressing the "reset" button here? Does this mean wiping out the database and starting fresh?
@f1nality This is rough bug to figure out. What is the work around to getting your dashboard to update with different modules? Wiping out the database isn't really an option for me. (I bought the license if that matters at all)
from django-jet.
I actually implemented a workaround for this. It involves overriding load_modules
method on the Dashboard
object. It now calls a new method called get_or_create_module_models
every time which either gets that specific module from the DB if it exists, otherwise it creates it. This allows you to modify the Dashboard and it will update as you would expect it to.
from jet.dashboard.dashboard import Dashboard
from jet.dashboard.models import UserDashboardModule
class CustomIndexDashboard(Dashboard):
columns = 3
# Moderator Tools
def init_with_context(self, context):
self.available_children.append(modules.LinkList)
def get_or_create_module_models(self, user):
module_models = []
i = 0
for module in self.children:
column = module.column if module.column is not None else i % self.columns
order = module.order if module.order is not None else int(i / self.columns)
obj, created = UserDashboardModule.objects.get_or_create(
title=module.title,
app_label=self.app_label,
user=user.pk,
module=module.fullname(),
column=column,
order=order,
settings=module.dump_settings(),
children=module.dump_children()
)
module_models.append(obj)
i += 1
return module_models
def load_modules(self):
module_models = self.get_or_create_module_models(self.context['request'].user)
loaded_modules = []
for module_model in module_models:
module_cls = module_model.load_module()
if module_cls is not None:
module = module_cls(model=module_model, context=self.context)
loaded_modules.append(module)
self.modules = loaded_modules
from django-jet.
@nryoung good man, i think you should make a pull request: this feature have to be in this package by default. @f1nality isn't it?
from django-jet.
Please come to the django-jet Discord server so we can organize if you like:
Welcome! 😄
from django-jet.
@Ismael-VC , what's about this? Did you test it?
from django-jet.
Related Issues (20)
- ImportError: python_2_unicode_compatible HOT 1
- ModuleNotFoundError: No module named 'jet.urls' HOT 2
- Issue with google analytics widget HOT 1
- Jet is not responding HOT 1
- get_model_queryset() missing 1 required positional argument: 'search_help_text' HOT 2
- ImportError: cannot import name 'python_2_unicode_compatible' from 'django.utils.encoding' HOT 2
- Demo site Admin panel not open (Server Error (500))
- Demo site Admin panel not open (Server Error 500)
- __init__() missing 1 required positional argument: 'search_help_text' HOT 8
- django-jet-4 not able to display individual DB entries : TypeError at '/admin/app/model-table/<int:pk>/change/' HOT 2
- this project will no longer be maintained??? HOT 2
- Compact Inline is not working HOT 1
- Connection refused by localhost when trying to add a foreign key in new model HOT 2
- Scroll down on admin columns get messed up
- admin_url with view permission HOT 1
- list_filter doesn`t display in jet admin panel, but it is shown in the normal version of the admin panel: python 3.10 django 4.1 HOT 3
- [email protected]
- add renderer=None to Credential Widget
- Groups and Permissions
- Logout error 405 using Jet, but logout normal without jet
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 django-jet.