Not sure how to begin programming a change to my results template/screen...
I have a search that users can use, it returns results from two related models with pagination. This works fine.
Users wondered if I could add a selection box for each returned entry.
If they selected 1 or more entries - then they could then push an export button, and all selected entries would be saved into a file with all fields listed in csv format.
The more I think about it I think I would need a completely different results template without pagination, just because I need to pass the query set to something to print this out, but only want the ones that were selected...
Anyone done anything like this?
Not really sure if any will have an answer but figured I would put it out there.
Thanks.
Related
I want to create a SelectField that offers suggestions but still allow the user to enter something else.
class MyForm(Form):
username = wtf.StringField()
title = wtf.SelectField('Job title', choices=['Owner', 'Manager'], validate_choices=False)
WTF documentation suggests that setting validate_choices to False allows this:
Note the validate_choice parameter - by setting this to False we are telling the SelectField to skip the choice validation step and instead to accept any inputted choice without checking to see if it was one of the given choices.
But, no data entry or modification is possible with above. Is this possible or do I need another 'manual entry' field?
Or, is there perhaps a way to show my suggestions in a StringField using JS similar to the way the browsers offer autocomplete suggestions for addresses etc?
I'm not aware of any way to do this. It seems you and I are in a similar position. However, I did have an idea I wanted to share that could work for you.
Many forms will have a dropdown with a value "Other" and if you select "Other" there is another empty box that appears for you to type in. You could implement this pretty easily in wtforms. Alternatively you could have the extra box always display and just do a check that they did indeed select "Other" if they have a custom input.
I have opened an issue, but they are not planning to add this feature.
Based on this, we could, but it is not a pure python implementation
I am new with Orchard and can not seem to get past this problem.
Goal
to be able to specify two text values on each page and show those in a styled DIV if they are not blank.
Procedure
I created a new content part in Orchard's admin named
"InnerPageTitleArea"
I added two fields to this part: IpTitle (Text Field) and IpSubtitle
(Text Field)
I added this part to the Page content type
Those textboxes show when editing a page, and I filled them in on
several pages
Those values show on pages they were entered on (all good so far)
The problem:
I want to provide a template for the InnerPageTitleArea, but all
attempts have failed.
When using shape tracing, there are no alternates referencing my
part alone
All alternates begin with "Fields" i.e.
~/Themes/MyTheme/Views/Fields.Common.Text-InnerPageTitleArea.cshtml.
If I use one of those field alternates, my template is repeated
twice - once for each field
If I use a field-specific template, i.e.
~/Themes/MyTheme/Views/Fields.Common.Text-InnerPageTitleArea-IpTitle.cshtml
I can actually get at both values, but then the other value
(IpSubtitle) still displays as plain text. I could probably remedy
that with Placement.info, but I suspect that I am just lacking some
fundamental understand of Orchard.
What to do?
Your part never renders anything because it doesn't have a driver that would create a shape. The only shapes that are getting out of that part are the shapes for each of the fields. The simplest way to get what you want is to create one alternate for each of the fields. Would that work?
So I have a search page with result table. I have a drop down that's a filter from the DB. Instead of calling and populating this drop-down field filter at my view/index() method, can I just call a helper function that returns this list from the DB and populates the drop down at the template level?
I know about context_processors and my understand is that it's for the entire site, but I want this DB call to only happen on this particular page and no where else?
What do call this so I can try to find it in django docs.
Much Thanks
edit: to clarify more: the result table contains movies and drop-down filter is movie types (actions, adventure, thriller, etc). This list is made up from a "SELECT DISTINCT type FROM movies" query.
The Django equivalent of helpers is custom template tags, and it's certainly appropriate to put db-accessing code there.
However, if it's only for a single page, I'm not sure why you wouldn't do it in the view.
I have become a bit confused on the best way to move forward with something I'd like to achieve in Wordpress. My problem is partly workflow I think and knowing the correct way to do what I'd like to achieve but also there may be a few blanks on how to actually implement some of what I need to do. I have checked various online resources but they all are specific to what they are doing and I can't easily understand them to apply them in to the context of my own project, which is why I wanted to ask here. I'm sure my initial question will inevitably branch out to sub questions but here we go:
For my website I have created a custom post type called 'projects'. I have successfully set this up.
Then for each project I need to allow the following data to be entered:
Project Title
Project Description
Also post meta data that will display as a list on each project page (I'll need to display both the key and value on the page but only for those fields that contain data 'i.e. I don't want the list to show as Location: blank'):
Client Name:
Location:
Project Value:
Architect:
Engineer:
Site Area:
My main question is this, I need to show images for each project and allow the user to select a 'template' for each project post, this is because there are about 5 grid designs for layout of the images (1 main Image, 1 square image with two small images right side, 3 portrait image cols etc).
I thought the correct way would be to create a custom post type called projects, add write panels to allow easy input of data (I've yet to add image uploads as this will need to vary depending on the template selected and number of images required), at data input stage the user selects the preferred image layout/template and then uploads images for the containers that allow images (I’ll need to id each image upload to position it in the template with CSS, that was the plan).
Firstly, am I approaching this correctly? And secondly, how can I add functionality to the write panel I have created to allow users to a) select a 'Template' (bit like you can with pages but for my custom post type) and b) to add image upload fields which change depending on the template selected?
Finally, I would like to stay away from using plug-ins and try and achieve this myself through functions.php etc. This is to avoid problems later as plugins update or lose support etc.
Any help is appreciated, thank you.
This sort of question seems to come up a lot in regards to Wordpress (I answered essentially the same question the other day). I know you want to avoid plugins but this sounds like a job for Advanced Custom Fields.
You can create exactly the fields you need for your custom post type (including an image upload field), and then add them into the template the corresponds with your custom post type.
ACF does have a 'lite mode' which can be included directly in a theme. This way you needn't worry about updates nuking site functionality. Believe me you will save yourself a lot of time and energy this way.
It's admirable to try and do it with pure WP, but it's a maturing platform, it just doesn't lend itself to this sort of customization easily.
I am building a web app that allows our field staff to create appointments. This involves creating a record that contains many foreign keys, of which some come from very large tables. For example, the staff will need to select one of potentially thousands of customers.
What's the best way of doing this in Django?
A pop-up box that allows the users to search for customers, gives them the results, the user selects the results, then fills out the main appointment form and then
disappears?
Changing the appointments form to a customer selection page that
then reloads the appointments page with the data in a hidden form? Or
holding the data in some session variables?
Some from of Ajax approach.
A wizard where the flow is: a customer search page, a list of results and they select from results, then a search page for the next option (for example product selection), etc etc
(I'd like to keep it as simple as possible. This is my first Django
project and my first web project for more years than I care to
remember)
ALJ
Imho you should consider some kind of autocomplete fields. I think this results in the best usability for the user. Unfortunately, this always involves Ajax. But if you think that all users have JS turned on this is no problem.
E.g.
django-autocomplete
or what is probably more powerful:
django-ajax-selects
If you do the wizard approach, it will take longer for the user to accomplish the task and makes it harder to change selections.
Edit:
Well with django-ajax-selects you can define how the results should look like. So you can e.g. add the address behind the name.
Quote:
Custom search channels can be written when you need to do a more complex search, check the user's permissions, format the results differently or customize the sort order of the results.
I have done this before by integrating a jQuery autocomplete plugin. But, seeing as this is your first project and your desire to keep it simple, I suppose you could go with the session data option. For instance, you could show a search page where users could search for and select a customer. You could then store the, say, ID of the selected customer object as session data, and use it to pre-populate the corresponding field in the form when displaying the form. That's what I think offhand.