I have script for my datatable. So, I store my attribute from API and I need to grouping column into one column. Can django do that? As long I know, that could but in JQuery, but it's impossible to bring my datatable to JQuery basics so many attributes.
Here is my code :
['No. Telp <br/>Nasabah 1','notelp1_debitur',''],
['No. Telp <br/>Pasangan 2','notelp2_pasangan',''],
['No. Telp <br/>Pasangan 1','notelp1_pasangan',''],
['No. Telp <br/>Nasabah 2','notelp2_debitur',''],
And I want to be grouping it like this :
Thanks in advance.
this is not related to django or any other backend frameworks how we are gonna show the data in frontend.
this is the html table, and how to put data in that table to create something like the photo.
you could create a table, or two.
for a cell of html table you could specify the col(s), and row(s) it needs to capture. read about this on w3schools.com
Related
I have the following situation.
The Flight model (flights) has a field named 'airlines_codes' (TextField) in which I store data in JSON array like format:
["TB", "IR", "EP", "XX"]
I need to filter the flights by 2-letter airline code (IATA format), for example 'XX', and I achieve this primitively but successfully like this:
filtered_flights = Flight.objects.filter(airlines_codes__icontains='XX')
This is great but actually not.
I have flights where airlines_codes look like this:
["TBZ", "IR", "EP", "XXY"]
Here there are 3-letter codes (ICAO format) and obviously the query filter above will not work.
PS. I cannot move to PostgreSQL, also I cannot alter in anyway the database. This has to be achieved only by some query.
Thanks for any idea.
Without altering the database in any way you need to filter the value as a string. Your best bet might be airlines_codes__contains. Here's what I would recommend assuming your list will always be cleaned exactly as you represent it.
Flight.objects.filter(airlines_codes__contains='"XX"')
As of Django 3.1 JSONField is supported on a wider array of databases. Ideally, for someone else building a similar system from the ground up, this field would be a preferable approach.
So I am pretty new to Sitecore, and I seem to have gotten myself into an issue that I cant solve or google ;)
So I have an item, this Item has a treelist, and that treelist has a datasource "Products". Now this works fine, the issue is that I only want the items (products) displayed in my treelist, where the Product Category is "Shoes".
The Product template has a Multilist named "Categories", so i would like a query, that evaluated if one of the Categories is "Shoes" if so, include the Product in my Treelist, if not exclude it.
Can it be done with a query or do I need to do some actual code to get that result?
Any help would be much appriciated.
You can use Sitecore's fast query in source field of template field as below:
Using contains:
fast:/sitecore/content/Home/Products//*[contains(#Categories = 'IdOfShoesItem')]
Using like:
fast:/sitecore/content/Home/Products//*[#Categories = '%IdOfShoesItem%']
On older sitecore version fast query does not work, in those cases replace "fast" with "query" like below:
query:/sitecore/content/Home/Products//*[#Categories = '%IdOfShoesItem%']
I am trying to fetch records from ExtJS store which start with specific substring.
e.g. If I have a country store and if I have a string 'IN' then I want records of India and Indonesia from store.
Is there any way to do this?
Thanks
I suppose this is about a combobox, so that's the default behavior.
For example: https://fiddle.sencha.com/#fiddle/11r4
If you just want to filter a store, look at:
filters config - Array of Filters for this store.
filter method - Filters the data in the Store by one or more fields.
filterBy method - Filters by a function.
Ext.util.Filter - Represents a filter that can be applied to a MixedCollection.
am Using Apex4.1,
in my application I have one Tabular form which has the following fields,
Emp_id
Emp_name
Dept_id
Here Emp_id is the Updatable column and it is a select list LOV and
Emp_name is a upadatable column,
Here what I need is,
If I select the Emp_id from the LOV ,the Emp_Name should be stored automatically based
on the value selected in EMP_ID,
In tabular form I could not create Dynamic action like creating in normal forms,
Can anyone help me in this issue?
Thank you.
APEX does not currently provide dynamic actions on tabular form items. Hopefully this may be addressed in APEX 4.2 but the Statement of Direction does not explicitly say so.
So for now if you need to do this you will have to write your own Javascript, using the unique IDs of the tabular form items to manipulate them (the IDs look like "fcc_rrrr" where "cc" is the column number and "rrrr" is the row number). See this SO q&q for sample Javascript code that uses these.
The Javascript you need to write is a little daunting (for a beginner), but one thing to note is that in your case you can avoid any need for using AJAX to get the employee name by embedding the name in the return value of the LOV something like this:
select emp_name d, emp_id||':'||emp_name r
from employee
order by 1
This way the return values will look like '123:John Smith'; your Javascript can parse this string and extract 'John Smith' and insert it into the emp_name item on the same row. Obviously you will also need to parse this string to obtain the emp_id value you will need when updating the database when the page is submitted.
I would like to use a ready-made select list of all the world countries (I don't want to store it in database) to fill an input field of a Django modelform, but I don't know which way to go.
Is there a way to do so?
http://code.google.com/p/django-countries/
Enjoy!
The only way I know to do that is to hardcode it into the template.
This list has it done already:
http://snippets.dzone.com/posts/show/376
by following this guide you can have automatic countries populated in your form field
http://code.google.com/p/django-countries/source/browse/trunk/docs/overview.txt