I am getting one problem while using django forms. Actually When I am using RadioSelect widget it is giving unnecessary div tags. Means each radio button is separated with individual div tag. And I don't want that. Please help Image of Div tags for each label
How can I get those label and input tag i.e Radio Buttons in single div tag not these many
index.html
forms.py
I am using crispy forms to make a django form which has several rows. The default behaviour is for the prepend box to be just the size of the text within it. However this looks messy when there are several fields and I would prefer the prepend box to be an equal width for all. An ugly hack is to just pad the prepend boxes that contain shorter strings with spaces but this is obviously not ideal. Any advoice on how to adjust the width of the prepend box to make them equal across fields?
This if the form helper I have where I define the prepend text
self.helper.layout = Layout(
Row(Field(PrependedText('field1', 'Field1prependtext            ', wrapper_class='col-md-4 pe-0'))),
Row(Field(PrependedText('field1', 'Field1prependtextlonger ', wrapper_class='col-md-4 pe-0'))),)
You can use CSS like:
.pe-0 .input-group > .input-group-text {
width: 50px;
}
Im writing a python script which reads from a file and plots graphs in seperate html files with plotly.I would like to have a button to redirect from one page to another(load from disc).I've come across this :
updatemenus = list([
dict(type="buttons",
buttons=list([dict(label = 'Next',method = 'update', args = ['shapes', []])])
)])
layout=go.Layout(title="Iteration_Number:"+str(counter_iter),updatemenus=updatemenus)
But this is used for updating data or changing layout. What i want is open another html page from disc on button click. Is that possible ?
I have also seen this :
import webbrowser
url = "file:///home/tinyOS/Simulation_"+str(counter_iter+1)+".html"
webbrowser.open(url)
Which helps me open a new page but again i want it to happen when clicking on the button.Any ideas? Thanks a lot !
From the question I understand that you want a group of buttons on the plotly graph, that are going to open a plotly graph in new tab.
So you need not use plotly buttons for this requirements.because they are mainly used for restyle, relayout, etc., so there is no relation between these buttons and opening links in new tabs.
I would recommend having simple html buttons which on click are going to take you to the new tab.
A simple way to do it will be, wrap the plot in a div set to relative positioning and make the div wrapping the button absolute positioned and position it anywhere over the graph, please refer the below example and let me know if this solves your issue!
Solution:
import plotly.plotly as py
import plotly.graph_objs as go
import plotly.offline as py_offline
from IPython.core.display import display, HTML
py_offline.init_notebook_mode()
display(HTML("""
<style>
.wrapper{
position:relative;
}
.button-group{
position:absolute;
top:40px;
left:90%;
z-index: 30000;
}
.button-group a{
display:block;
}
</style>
"""))
What is happening in the above piece of code is, first we include the necessary packages, then styles needed!
data = [go.Bar(
x=['giraffes', 'orangutans', 'monkeys'],
y=[20, 14, 23]
)]
display(HTML("""
<div class="wrapper">
<div class="button-group">
Google It
Yahoo It
</div>"""
+str(py_offline.plot(data, filename='plot_name' ,output_type="div", include_plotlyjs=False))
+ '</div>'))
The main piece of code, with which we embed the buttons is shown above, first we define the plotly plot , then using display and html functions, we can embed the buttons inside a div with class button-group and with CSS we position that button.
Please do try the above code and let me know if there are any doubts regarding the working!
I have add a custom plugin that insert custom tags into my tinyMCE editor of the format:
title
I want the custom tags to be rendered with some styles when viewed in the WYSIWYG view. I have seen one response to a similar question :
http://topsecretproject.finitestatemachine.com/2010/02/how-to-custom-tags-with-tinymce/
but this doesn't work - they tags are not stripped out but they are not styled either??
You need to use the content_css initialisation parameter:
content_css: my_css_file.css
containing something like
title {
// css here
}
I have a Django form using textareas and TinyMCE for text entry.
I would like to add a slider to change the vertical size of the textarea, like SO has them so nicely.
How can this be done?
Just add 'theme_advanced_resizing : true' In the tyniMCE init call