djafarsidik's Blog
Not everything about what I'm thinking
Tuesday, August 2, 2022
Thursday, June 9, 2022
Network not connected in Ubuntu 18.04 (network interface not detected)
- Check network interface availability (logical name) :
sudo lshw -C network
- Set / change interface name in /etc/network/interface
Saturday, March 19, 2022
Odoo 14 sequence not working when create model (TypeError: not enough arguments for format string)
Tuesday, March 8, 2022
Cannot change built in display resolution (Ubuntu 16.04)
I have been frustated since I was not able to setup built in resolution in my Ubuntu 16.04,
it was stuck to 800x600 pixel.
I have tried to change the resolution by following this tutorial, but it did not work.
https://askubuntu.com/questions/1075157/unable-to-set-my-screen-resolution-higher
and finally I found the solution by following below tutorial :
https://askubuntu.com/questions/441040/failed-to-get-size-of-gamma-for-output-default-when-trying-to-add-new-screen-res
in short the solution is to change the following line in the grub file :
#GRUB_GFXMODE=640x480
I change it to 1920 x 1080 for the resolution and remove the # :
GRUB_GFXMODE=1920x1080
And after that update the grub and reboot the server.
sudo update-grub
sudo reboot
Locale issue (ValueError: unknown locale: UTF-8) with odoo 9
export LC_ALL=en_US.UTF-8
export LANG="en_US.UTF-8"
Friday, February 25, 2022
Macbook bootloop "Unrecoverable error. Security agent was unable to create requested mechanism TeamViewerAuthPlugin:start"
Friday, October 22, 2021
Adding LogEntry to Django Admin
from django.contrib.admin.models import LogEntry, DELETION
from django.utils.html import escape
from django.urls import reverse
from django.utils.safestring import mark_safe
@admin.register(LogEntry)
class LogEntryAdmin(admin.ModelAdmin):
date_hierarchy = 'action_time'
list_filter = [
'user',
'content_type',
'action_flag'
]
search_fields = [
'object_repr',
'change_message'
]
list_display = [
'action_time',
'user',
'content_type',
'object_link',
'action_flag',
]
def has_add_permission(self, request):
return False
def has_change_permission(self, request, obj=None):
return False
def has_delete_permission(self, request, obj=None):
return False
def has_view_permission(self, request, obj=None):
return request.user.is_superuser
def object_link(self, obj):
if obj.action_flag == DELETION:
link = escape(obj.object_repr)
else:
ct = obj.content_type
link = '<a href="%s">%s</a>' % (
reverse('admin:%s_%s_change' % (ct.app_label, ct.model), args=[obj.object_id]),
escape(obj.object_repr),
)
return mark_safe(link)
object_link.admin_order_field = "object_repr"
object_link.short_description = "object"