Multiple Views in One Template - django-templates

I have two views:
1 - DisplayInfo (displays information from User Table)
2 - AddTopics (Adds data into the Topics Table)
and one template:
1- Test.html
--
The problem I have is, I can't display the stuff I want from both views on the template, only one of them. I have associated both views in URLs.py, but the urls.py will read the first instance rather than both, so only one view gets displayed on the template, and ignores the other.

Well, I have figured out a temporary solution. I have used a iFrame to load a second template into my main template. It by far not the best solution, but it's better than having no solution.
I'll keep the question up here, just in case someone else has the same problem, or if another has a better solution.
Thanks

Related

Comment functionality on every page in Yii 1.1

I am using Yii 1.1.16 for one of my projects.
I have 5 controllers at the moment, and their data is coming from their respective models.
Now I want to add new functionality into my website, regarding comments. I want to add a form at the bottom of each view, but obviously the data will be coming from another database table (I have created a new model for that).
I am confused. Should I create 5 different forms in HTML for my problem, or can I use Yii widgets functionality to implement the same?
The Comment table would be the same for every user in the database. Comments will be coming with the help of their user id, which is stored in the table, and their comment will be inserted with the help of their user id, too.
Please let me know the best solution you can think of.
I suggest to create one widget for displaying comments section and one controller for handling request from this widget (for example adding new comment or displaying different page of comments list). In this way adding comments for any section should require only few lines of code to initialize widget:
$this->widget('CommentsWidget', [
'parentId' => 'page-' . $model->id,
]);

Custom odoo module - how to make a table

I am creating a custom module with additional part numbers on a separate tab in the products screen. I have built the module, but am having trouble figuring out how to display the information so it matches the layout in the attached image. I have tried tree view but have not been able to get the fields on the same line. Can this only be accomplished through css or is there a table view that I am not aware of?
I also need to make sure that all of the information in row 1 stays tethered together for additional forms, etc. My plan is to make the field names for each row end with a different number (i.e. x_mfrname1,x_mfrpn1,x_mfrname2,x_mfrpn2, etc.). Can somebody please just tell me if I am on the right track. This is the initial Odoo setup for a client of mine and I don't want them to come back to me down the line and find out I forgot something. I have been scouring the internet and reading a few books but I am not completely confident.
Here is a link to a layout of what I am talking about:
MFG Part Number Tab
Thanks!
class sub_part_details(models.Model)
_name='sub.part.detail'
primary_pn=fields.Boolean('Primary P/N')
obsolete=fields.Boolean('Obsolete')
pn=fields.Char('P/N')
desc=fields.Char('Description')
upgrade=fields.Char('Upgrade')
part_detail_id=fields.Many2one('part.details')
class part_details(models.Model)
_name='part.details'
cat=fields.Char('CAT')
sub_ass=fields.Char('Subassembly')
main_ass=fields.Char('Main Assembly')
notes=fields.Text('Notes')
sub_details_ids=fields.One2Many(''sub.part.detail','part_detail_id')
It might be helpful

In Refinery CMS, how can I change the template for the pages generated by the Inquiries extension?

I tried the simple approach: editing the Contact page in the admin interface and selecting my new template within the Advanced Options section. But the form does not get displayed.
I also generated the override views:
rake refinery:override view=refinery/inquiries/inquiries/*
But looking at the app\views\refinery\inquiries\inquiries\new.html.erb file, I did not see an obvious solution to this issue.
I found this issue on github but it does not offer much detail: https://github.com/refinery/refinerycms-inquiries/issues/45
I suspect a big part of the issue is that when I change the template setting under Advanced Options, it's changing the view from the default inquiries new.html.erb to one of the standard view options. The problem is inquires extension new view is not listed as an option.
The short answer here is: you can't.
In the course of struggling with this, I came to realize that in most cases you probably don't want to be switching layouts. Not in the casual manner that I was, anyway.
What I really wanted were alternate page views. The basic web page layout and styling can be fully modified through views.
Realizing this changed my objective. I didn't need to change the layout for the inquiry pages. I needed to match the inquiry page views to my default page view. I was able to do this by overriding the inquiries extension's new and thank-you views and editing those files so that the markup and styling matched that of my default page view.
Simple enough. The only downside is it's a bit un-DRY. If I were to alter my page view, I now would likely have to repeat the changes in those two views as well.

Virtual TableViewer sorting causes selection problems

Our application is an RCP appliction and needs to display table of several thousands items. For this reason, we're using SWT.VIRTUAL in our TableViewer. That works pretty well except for selection.
We're having following issue :
Our TableViewer support sorting and filtering. When we use a virtual tableviewer, changing the selection does not preserve the current selected item but the row currently selected.This leads to another item being selected.
e.g: If Item 'A' present at the 5th row is selected by user and sorting is performed, then after sorting the Item at the 5th row gets selected instead of the Item 'A'.
Using a non virtual TableViewer, everything works fine.
We tried to go into debug and found out that the cache from the AbstractTableViewer.VirtualManager class seems to be up to date with the model.
Forcing the cache to be used in the AbstractTableViewer.virtualSetSelectionToWidget() can be a possible approach.
We have tried to implement a solution suggested in https://bugs.eclipse.org/bugs/show_bug.cgi?id=338696. However it didn't work.
Please suggest some pointers or alternative work around.
Thanks for the answers.
As a workaround for working with huge tables I would suggest you to take a look at the Nattable project http://www.eclipse.org/nattable/. It supports everything you need (sorting, filtering, tree structured elements, lazy loading etc.). We successfully use it in our project, where it is necessary to display hundreds of thousands elements as a tree with around 160 columns. It also has some pretty cool styling features, which can make your table more user-friendly and interactive. Hope this helps

Dynamic Div placement based on number of values in a list

I want to be able to change the design of the website based on the content in my database. For example: I have a list of instances of objects that is being pulled from a database, and will be used to populate my website. I want the website to look similar to www.reddit.com, where there is a <div> for each post. However, I can't figure out how to variably change the location of that <div>. So for the first instance of that object it will be located at top:60px; the second top:200px; etc... (not those exact numbers). If you need any clari
Was looking for some help! Thanks,
Figured it out! I added a variable that I then used to define the "top:" in the html of the template. If anyone wants me to explain further please let me know.