Questions tagged [templates]

29640 questions
1

votes
1

answer
58

Views

How can I get the current user's group in forms.py in Django?

I have a scenario where i need to pass the logged-in user's groud name and get the list users in that group. forms.py -- in the below code i need to pass the user's group instead of Banglore class UpateTaskMaster(forms.ModelForm): def __init__(self, *args, **kwargs): super(UpateTaskMaster, self).__i...
Mohamed Naveen
1

votes
0

answer
55

Views

template substitution failure with sfinae

The following code does not compiler with GCC 5.2 or later, have not tried older compiler. Amy idea on what I am doing wrong here. #include #include #include template typename std::enable_if::type operator^=(T &lhs, const T &rhs) { lhs = static_cast( static_cast(lhs) ^ static_cast(rhs)); return...
Sameer Varyani
1

votes
1

answer
54

Views

Can I color hg log output based on content?

Is it possible to color each line of hg log output based on the individual changeset's content and/or description? For instance, I'd like to help the 'real' work stand out, by graying out the lines for merges and the lines for changes that only touch testing resources (no programming language files...
Joshua Goldberg
1

votes
0

answer
149

Views

C++ templates: late instantiation of enable_if member function warning

I'm trying to late instantiate an enabled_if class member function (need it to bypass circular dependencies), but I'm getting 'warning C4544: 'itemType_inner': default template argument ignored on this template declaration' in Visual Studio 2017 (/std:c++latest). Now I've read what it says at Compil...
Waldemar
1

votes
1

answer
279

Views

DJango-tables2 how do I refresh/update the table on the webpage without hitting refresh button

I followed the DJango-tables2 official tutorial and was able to create data set in the terminal using: Person.objects.bulk_create([Person(name='Jieter'), Person(name='Bradley')]) However, the new data in the table on the website doesn't show up until I hit the refresh button. My question is how the...
szd116
1

votes
2

answer
101

Views

Django Model serving Media Files

I have two models: Packages and Images. Images has many to one relation with Packages. Images table has a foreign key package_id. I have to display the attributes country, price of Packages with one image related to the package. There can be many images related to a single package however, I have to...
Shekhar Khatri
1

votes
0

answer
87

Views

How to use formatvalue filter for field in form template?

In Django templates, we use the filter on value fields such as {{value | formatvalue}} I want to generate my form dynamically like the example below. {% for field in form %} {{ field }} {% endfor %} As you know, the field attribute will be generated as an html element. Is there a way to add a filter...
Harun ERGUL
1

votes
1

answer
65

Views

Templated function pointer with arguments as template parameter

I can't get my code to compile. I want to be able to declare a function that takes another function (or a class with operator() defined, or lambda expression) as parameter, and this function has template arguments as well. Here's an example of what I want to do: template T execF(T a, T b) { retu...
amon880
1

votes
0

answer
49

Views

How to re-increment each id attribute in Formset after deleting a Form in Django?

I currently have a formset rendered to a template, where I do a for loop over it to display each form. I have a button which adds extra forms and I also have a delete button which removes any of the forms. My problem is when I delete one of the middle forms, the incrementing from the formset managem...
David Arce
1

votes
0

answer
415

Views

Angular Component view Inheritance

I'm using angular4 since few month now, and I'm trying to figure out, how can I build inheritance between component. So in my exemple I have two component ParentComponent and ChildComponent ParentComponent.ts import { Component, OnInit } from '@angular/core'; @Component({ selector: 'app-parent', tem...
Nicolas Pretot
1

votes
1

answer
27

Views

Widget attribute does not work

I have two forms and a formset. I have given __init__ for both the forms. However in my template only my POBodyForm is rendered with the attributes. Looks like __init__ of POHeaderForm is not working. I am not sure what is the error. Can someone please advise? I have been using the similar __init__...
Thaha
1

votes
1

answer
322

Views

Custom CSS attributes for Angular components

I have an Angular component that encapsulates a picture carousel. If uses the :host selector to make itself a flexbox and ngFor to repeat an img tag for each picture in an array of pictures passed in to it through an @Input property. I have two, related problems. 1) I want to allow the pictures t...
Richard Payne
1

votes
1

answer
38

Views

How to implement template methods for a tree that has only two types of nodes?

I'm implementing a tree where each Node is only either an InnerNode or a Leaf which I would normally implement like this: class Node { public: virtual ~Node() = default; }; class InnerNode: public Node { std::vector children; ... }; class Leaf: public Node { ... }; Now I would like to have a templat...
eyelash
1

votes
1

answer
262

Views

How to render an html template from express, while on Angular5

So, I ran into a fairly unique situation. I was tasked to convert an existing repository that's running server-side express and html as its view engine, to express with client-side Angular (5). I got stuck, when I arrived at an html view that I couldn't convert to Angular, and would like to have exp...
David Lee
1

votes
1

answer
104

Views

How do I activate syntax highlighting of an Xcode file template?

I’m creating a file template for a file with an extension that Xcode doesn’t recognise. Xcode doesn’t apply syntax highlighting to the file but I’d like it to. I would like Xcode to recognise the file as com.netscape.javascript-source even though the file extension isn’t .js (the file is a...
Kerndog73
1

votes
1

answer
250

Views

PHP/JS use use templates to create PDF and doc/docx/otf files

Hello as I am dyslexia my text writing skills are not the best, so please bear with me. I have a problem that I am kind of stuck on. I have a form on a webpage where a user fills in their details and clicks submit, after that a mail is being sent with a PDF as an attachment to my email. ATM. I am us...
Benjamin Karlog
1

votes
0

answer
92

Views

Facebook Structured Message (Template) in conversation api

I'm working on linking a Messenger Bot with a Inbox Manager App. Inbox Manager App need to get old messages from /conversation API https://developers.facebook.com/docs/graph-api/reference/v2.11/conversation/messages to display old messages. However, I can't find proper data to display it. Example: 1...
Nguyễn Huy
1

votes
1

answer
157

Views

Django Multiple Record Insert CreateView ( not enough values to unpack (expected 2, got 1))

i am getting the following message while saving the record. not enough values to unpack (expected 2, got 1) I am getting a Acquisition ID and attaching qoutations(single or multiple ) and once saving the record the system pops out the error. there is no error if i select the ACQID from createview...
Najeebullah Usmani
1

votes
0

answer
47

Views

django create N number of forms in template

I was wondering if it was possible to write a more generic form to use as a template so that during the render it will create as many forms as necessary? If not how would one write code to create N number of forms, where the number is Dependant on the result of some query set, and also the options i...
noone392
1

votes
0

answer
143

Views

Dynamic blaze template with dynamic data not working

I am developing an app using Meteor-1.6+Blaze+materialize and create a multiple modal template for example aModal, bModal, cModal..etc and calling these template into main template on buttons click using ReactiveVar. this.modalTemplate = new ReactiveVar(false); this.modalData = new ReactiveVar({});...
Amit
1

votes
1

answer
329

Views

Implementing themes in Django (Custom templates by users)

I want to implement the feature for admins to set custom templates. Like they can place themes or templates in a particular folder relative to the home folder. Each theme may have a folder and some config or preview for example(optional). 1) First I need to figure out how to set custom templates di...
Kotlinboy
1

votes
1

answer
105

Views

Template specialization for derived classes with a common base

I want to make template specializations for classes with unknown name, I only know their base, and i want all derived classes to fall onto the specialized template functions. The following code is a working one for Case 1-4. I couldn't make Case 5 to work. Also this is mostly runtime checking with t...
csiz
1

votes
0

answer
250

Views

My HTML table is with pagination, and I want to download the whole table rather than the current visiable rows

Am new to exporting html table to csv. The code below could export only the current visible page, but I want to be able to download from pages 1 -- 200 for instance at a click of a button. // download html table to csv file function downloadCSV(csv, filename) { var csvFile; var downloadLink; csvFile...
Danny76
1

votes
0

answer
117

Views

Live Template to log all variables in selection

I have a good collection of live templates that help me work efficiently, but I have yet to discover a live template which logs all variables and their values. Is there a way it can be done? I'm not familiar with groovy script… Example: int i1 = 1, i2 = 2; Selecting the above and using the surroun...
RJFares
1

votes
0

answer
236

Views

How to Upload a text file in django using templateview based view and model based forms

I am new to django and stuck on uploading a simple file. I am using TemplateView as views and model based form. I am stuck here. I have no idea what to do. I am using django 2.0. I have attached the code what I have done so far. setting.py import os BASE_DIR = os.path.dirname(os.path.dirname(os.path...
Arshad
1

votes
0

answer
192

Views

How to determine wagtail Page content type within django template?

The core problem is that handling of wagtail RichTextField and StreamField is radically different in the templates. I'm trying to accomplish something similar to the following: {% with post=post.specific %} {% if post.content_type == 'streamfield' %} {% include_block post.body %} {% else %} {{ post....
NarūnasK
1

votes
0

answer
115

Views

document.getElementById() on a value that is set through a Meteor template

So I've been trying to build a website using Meteor and am quite new with it. I am trying to have javascript that will make use of the values on the page and then create a download from those values. These values differ depending on which page the user is on as the meteor template is loaded with spe...
AyHO2
1

votes
0

answer
164

Views

Sitecore - How do I change the template of an existing media item from unversioned to versioned?

Sitecore 8.2 A great many media items have been uploaded as 'unversioned' template /sitecore/templates/System/Media/unversioned/Jpeg. These need to be versioned template /sitecore/templates/System/Media/Versioned/Jpeg If I use content editor to 'Configure->Change' and select the template that I wa...
Bryce Sharp
1

votes
0

answer
70

Views

Nunjucks Templating Two column layout

How can I do this in Nunjucks? I have a main layout file that defines the HTML page with the and all file includes and meta data. Then I have a homepage template that extends layout. In this homepage, I would like to include a reusable two column layout that I will also use on other pages. Inside t...
Russell Strauss
1

votes
1

answer
117

Views

Variadic template taking reference to data types

I would like to create a wrapper for class methods so I used a variable template and std::tuple to wrap the method. It works as I need, but I cannot figure out how to be able to wrap a method with parameters called by reference. Please see the main function below. #include #include #include using...
vitakot
1

votes
1

answer
43

Views

How can I turn on the auto matching when invoking the template explicit instantiation?

I have two template class, and the Leaf is derived from the Base, then I developed a template function which uses the reference of the Base as its parameter. And set the definition and the instantiation of that function in its source file. The issue happened once I tried to pass the Leaf as the argu...
Calvin
1

votes
0

answer
394

Views

C++ error: request for member … which is of non-class type

I've tried looking at other similar questions, but they all seem to contain answers regarding a feature of c11 I'm using. When running the following code I get the error: error: request for member 'current' in '((mtm::MtmSet)this)->mtm::MtmSet::it.mtm::MtmSet::iterator::operator->()', which is of no...
Osmosis Johns
1

votes
2

answer
72

Views

CanI see and copy the templates from Wikipedia or other Wikis?

I am a postgraduate student in experimental physics, and my university offers a wiki service as a lab book for different groups. Unfortunately they only offer the basic functionalities, like links and categories, and they have not implemented the full plethora of templates of Wikipedia. All the in...
SuperCiocia
1

votes
2

answer
310

Views

how to write a C++ class member function wrapper?

I want to wrap some class member functions and do some preparing and cleaning up work around them. I try to copy some other thread pool code but get some error I cannot deal out. How to do it correctly? #include #include using namespace std; class A { public: void connect() {}; void close() {}; te...
Liu Weibo
1

votes
0

answer
82

Views

Converting variadic template to variadic function

Given the following case: #include enum class Event { None, Resize, /*Some Other Events*/ }; template struct validator; template using eventor = typename validator::type; template struct validator { using type = void(*)(unsigned int, unsigned int); }; struct My_Event { unsigned int size; void** fun...
Juan
1

votes
0

answer
122

Views

Woocommerce Custom Email path in Plugin

I create a custom order status and the . also cerated a custom email that are fired manually when the status is changed to my new custom status. It works 100% if my custom email template reside in plugins/woocommerce/ \plugins/woocommerce/templates/emails/logistics-eft-paid.php But i need to add the...
user1664798
1

votes
0

answer
54

Views

Weakly linked template specializations

Is it possible to define weakly linked template specializations? In math_functions.h I have: namespace utils { template T_TYPE sqrt(T_TYPE value); template float sqrt(float value) __attribute__((weak)); template double sqrt(double value) __attribute__((weak)); template long double sqrt(long doub...
Erik Van Hamme
1

votes
1

answer
91

Views

Copy ManyToMany Value

I am currently trying to copy a many-to-many-field from one model to another but running into a bit of trouble. I have been able to create the model fine with a many-to-many-field with a ModelMultipleChoiceField, and the model saves the way I want it to. When I try to copy it to another model, I d...
Steve Smith
1

votes
0

answer
194

Views

-fabi-version=6 (or =0) avoids this error with a change in mangling

I have code like so: namespace MLX90393 { struct status_t { // simplified for example, real implementation is more involved uint8_t data; explicit operator uint8_t const () { return 0; }; }; } struct zyxt_t { uint16_t z; uint16_t y; uint16_t x; uint16_t t; }; } template class MLX90393_raw { public:...
Udo Klein
1

votes
0

answer
25

Views

What (un)templating engines allow to read DOM read back to JSON?

Most every templating engines take some template and some data and evaluate/render/compile/precompile them together into an output that is either a string or browser DOM/HtmlElements. data + template [templating engine]-> resultString/resultDom I am looking for a 'de/untemplating engine' allowing fo...
humanityANDpeace

View additional questions