Hi Christian,
Thanks for the immediate response. I was on vacation last week, sorry for
the delay response.
I have written one extension as a package for customized widget on admin
page with the following files and directory structure :
cd reviewboard
mkdir -p mywidget
cd mywidget
mywidget
- setup.py
- mywidget (directory)
- __init__.py
- extension.py
- admin_urls.py
widgets (directory)
- my-widget.html
setup.py :
--------------
from setuptools import setup
PACKAGE = "mywidget"
VERSION = "0.1"
setup(
name=PACKAGE,
version=VERSION,
description="Test of customized admin widget",
author="pradeep",
packages=["mywidget"],
entry_points={
'reviewboard.extensions':
'%s = mywidget.extension:MyWidget' % PACKAGE,
},
package_data={
'mywidget': [
'mywidget/widgets/my-widget.html',
],
}
)
extension.py :
--------------------
from django.utils.translation import ugettext_lazy as _
from reviewboard.admin.widgets import Widget
from reviewboard.extensions.base import Extension
from reviewboard.extensions.hooks import AdminWidgetHook
class SampleWidget(Widget):
widget_id = 'my_sample_widget'
title = _('My Widget')
template = 'mywidget/widgets/my-widget.html'
class MyWidget(Extension):
def initialize(self):
AdminWidgetHook(self, SampleWidget)
my-widget.html :
------------------------
<!DOCTYPE html>
<html>
<body>
<div id="mywidget">
<table border="1" style="border: 1px solid black;border: 1px solid
#CCCCCC;border-radius: 5px; width: 200px;">
<thead>
<tr>
<td align="center" style="background: #DDEBF9; height:
40px; font-weight: 400;">ADAM WIDGET</td>
</tr>
</thead>
<tbody>
<tr style=" height: 200px; font-size: 16px; font-weight: bold;
color : #888A85; text-transform: capitalize;">
<td align="center">None Available</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>
Reviewboard version : 2.5.7
After that I ran 'python setup.py develop', it successfully generated
mywidget.egg-info.
Then I went to my reviewboard admin page, clicked on 'Extensions' and then
'Scan for installed extensions'. my extension doesn't exist.
Could you please help me out here. Please correct me if I missed anything
or made wrong. I am new to Django.
Note : I didn't find ./contrib/tools/generate_extension.py in my
reviewboard package.
Please help me to add a customized widget on my admin page.
Thanks for your timely help.
Regards
Pradeep Kumar
On Thursday, December 22, 2016 at 5:53:46 AM UTC+5:30, Christian Hammond
wrote:
>
> Hi Pradeep,
>
> You'll need to follow the guide on writing, packaging, and loading
> extensions. This will have to be written as a packaged, loadable extension,
> which will be enabled through Review Board. It won't work as a standalone
> script, since it won't be running within the context of Review Board.
>
> Christian
>
>
> On Tue, Dec 20, 2016 at 07:17 pradeep kumar <[email protected]
> <javascript:>> wrote:
>
>> Hello There,
>>
>> As
>> https://www.reviewboard.org/docs/manual/2.5/extending/extensions/hooks/admin-widget-hook/,
>>
>> I was trying to add a widget to my reviewboard admin dashboard.
>>
>> Review Board 2.5.7
>> Python Version 2.7.5
>> django Version (1, 6, 12, 'alpha', 0)
>> OS Version :
>> Linux centos72_base 3.10.0-327.10.1.el7.x86_64 #1 SMP Tue Feb 16 17:03:50
>> UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
>>
>>
>> When I try to run above example code, I got the following output :
>>
>> >>> import os
>> >>> os.environ.setdefault('DJANGO_SETTINGS_MODULE',
>> 'reviewboard.settings')
>> 'reviewboard.settings'
>> >>> from django.utils.translation import ugettext_lazy as _
>> >>> from reviewboard.admin.widgets import Widget
>> Unable to import settings_local.py: No module named settings_local
>>
>> Please see https://www.reviewboard.org/docs/manual/dev/admin/
>> for help setting up Review Board.
>>
>>
>> Could anyone please help me here and please provide detailed step-by-step
>> process (1. Where I need to keep my python script, 2. Where I need to run
>> my python script, 3. How to verify my widget is working or not, 4. Do I
>> need to restart reviewboard server etc.,) to create a new custom widget on
>> my reviewboard admin dashboard page? Sorry I am new to django framework.
>> Appreciate your timely response.
>>
>>
>> Thanks & Regards
>> Pradeep Kumar
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> --
>>
>>
>> Supercharge your Review Board with Power Pack:
>> https://www.reviewboard.org/powerpack/
>>
>>
>> Want us to host Review Board for you? Check out RBCommons:
>> https://rbcommons.com/
>>
>>
>> Happy user? Let us know! https://www.reviewboard.org/users/
>>
>>
>> ---
>>
>>
>> You received this message because you are subscribed to the Google Groups
>> "reviewboard" group.
>>
>>
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected] <javascript:>.
>>
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>>
>>
--
Supercharge your Review Board with Power Pack:
https://www.reviewboard.org/powerpack/
Want us to host Review Board for you? Check out RBCommons:
https://rbcommons.com/
Happy user? Let us know! https://www.reviewboard.org/users/
---
You received this message because you are subscribed to the Google Groups
"reviewboard" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.