Dynamic Div placement based on number of values in a list - django-templates

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.

Related

How can I pass same data to multiple views in Odoo?

I have some data that I need to pass to every website views in Odoo. The problem is that I don't know the proper way to do that. I have thought about manually add them to every render method, but it doesn't feel right for me. And it violated DRY, of course.
I am using Odoo 12. Thank for your help!!
every page of odoo call website.layout template (for header & footer) so you can place your data in layout template and it will available in every page

Change product image on variant change

I am struggling to find an ideal solution to change the product image based on the variant selection. I do not see any identifier on the product images using which I could do a cross matching for js change event.
Every theme has this feature, so I guess, there is a pretty good solution to this.
Can you please help me showing the right path?
Thank you.
It depends on the design of the page and what are using.
For example if you plan to show a single image for the variant change you can use the variant image directly.
But if you plan to use a gallery of images there are different approaches. The one I use in most cases is to set an ALT attribute to each image with the name of the color that it's pointing to. Based on those ALT attributes I use some JS logic to filter specific images and show the correct ones.
Other approaches will be to use metafields, tags, linklists etc... A lot of different ways, but each is tied to some JS logic and some bad user experience for the administration since he will be required to switch between different pages and to create different elements in order to tie them to the images.
The final way is to use a separate APP for this.

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

Extend Page Property with custom controls in Sharepoint

Sharepoint is quite limited when it comes to multi-Lookups because it saves that information in strings. So I changed the Page-Property
"Elements (MultiLookup-> elementIds" on the propertyPage
to an inserted List "PageElements":
"
(SingleLookup)pageId , (singleLookup) elementId"
Because this is quite hard to maintain for my content admins I want that they can enter that information in the page properties like before instead of adding lines into "PageElements"
Therefore I want to add a control that handles that.
I do not need a solution for the task how to achieve that specific function, but a general hint how to add any custom control into a Page property.
I starting point link would be very nice. I just doen't seem to find the right words to feed google with my topic.
Solved this by using a custom field type with that logic. Basicly Described here: http://avinashkt.blogspot.de/2011/07/creating-custom-field-in-sharepoint.html

Sitefinity 4.4 - Dynamically change page title and description at runtime

Does anyone know how to dynamically change the page title in Sitefinity from a regular user control?
Our scenario is simple. We have a real estate website with a search feature. On the search results page we have a control showing the search results, but we need to be able to change the Page title, description and keywords based on the search performed.
We posted on Telerik, but they gave vague answers and pointed us to incorrect objects or objects that didn't actually work.
?
Regards,
Jacques
The way I've usually done this in the past is by using an external widget template.
By mapping your widget template to an external file, you can use a full User Control (.ascx file) which means you can also run code behind.
From there it's just a matter of running something like
Page.Title = "whatever";
For more info on using an external template for Sitefinity Widgets, check out this post: http://www.sitefinity.com/blogs/joshmorales/posts/11-05-10/mapping_external_templates_for_sitefinity_4_widgets.aspx
Hope this is helpful!