Add a filter to an add page in django admin - django-admin

Within my site, there is a model that contains two fields, pattern and group.
I am trying to have a search within the add function for the model. The reason is that there are over 1000 patterns, and having them all in a select isn't very user friendly. I would like for the user to be able to enter a pattern, then have the user select from the patterns matching their search. Is there any way that I could do this?

Related

How do I get MS-Access form entries to save to a table (or query)?

We have two teams working on system related issues and my Access database has one table for each teams open issues. I have created a query that matches issues from each list based on the system name. The query is returning potential matches correctly.
From there, I need to be able to review each "match" and select yes or no on a dropdown to confirm if both teams are working the same issue in order to quickly and easily reduce redundancies. I would prefer to review each result in a form format and have figured out how to add a dropdown box with the yes/no options; however, once I've validated each item, I'd like to filter the results down to only show the items that have been designated as "yes".
That's where I'm stuck. The form is not currently saving the results, including the dropdown info, to a table from what I can see.
How can I get the form to load to a table (or query) in order to filter out the "no" responses?
Try converting your query to an append query or an update query. Create a new table that this query adds data to, and in that table create a new field called "YesNo" or something like that. Put that new field from your table as a control source for your dropdown and should add a value in the "YesNo" field in your new table based on what you select. I'm not sure what value will be added to the table, I did something similar with a check box, when it's clicked it adds a "-1" and when it's unclicked, it adds a 0. Then I run a report that selects records based on the value in that field. I'm assuming the dropdown would work in a similar way but not a 100% sure. Hope I understood your issue, I'm no expert at access but I ran into the opposite issue recently where I didn't want the form to save the results.

Rails: Create a drop down list (within a form) where it's possible to select more than one value

(I've made up the example below as it's clearer than going through my specific case.)
Suppose I have a form for a User, and that the underlying User table has a personality_traits field; an array of the user's personality traits. Is there a standard way in rails to create a drop-down list so that the user can pick any number of a selection of attributes (e.g., "easy-going", "fun-loving", "quick-tempered"), and have these ultimately feed into the personality_traits field as an array? If not, does anyone know of a particularly good method?
bootstrap multiselect will do what you're looking for

What is the recommended MVC design pattern for adding non-existent foreign key?

You are building an MVC5 EF6 application where the user will add musical albums. A musical album has artist, record label, and category foreign keys which are each represented my their own respective models. On the create album page, the user will select through a drop downs the record label, category and artist. What happens if that artist or record label hasn't been entered yet?
Does the user have to go to the artist or record label view to add it first, then go back to the album page to create the album? Is there a better way to optimize the user process flow?
I had considered using a UI accordion that would be in the album view which would have panels for the album, artist, record label and category models. The artist, record label and category panels would start collapsed. If the user selects "Other" in the drop down for the artist, record label, category , the respective panel would expand and give the user the opportunity to enter the necessary fields to create the record label on the fly. Is this a bad idea? Are there other options I haven't considered that make the process easy for the user?
There are really only two options here:
Let the input form allow a new entry for Record Label, etc. This opens up the possibility of course of duplicate entries (spelling, abbreviation, etc.)
Create another form(s) where you manage those foreign keys, allowing someone to add a new label, artist, etc. The same possibility of duplication exists, however you might be able to introduce some fuzzy logic to search for similar names when an entry is added.
Either of these methods could also incorporate moderation, forcing new entries to be vetted by you or by some other entity, but of course that takes time. The biggest factor for me in making that decision would be whether or not the users of the system could be trusted to make intelligent decisions. (ie find an existing name and use that rather than just keep duplicating)
As far as the design, that's highly preferential and doesn't really have a correct answer. The best solution there is to make a mock up and have someone unfamiliar with the project use the site and get their feedback, and make changes accordingly.

Backendless iOS: intermediate table between two tables

I am new in Backendless and I have read all the manuals about relations, but still not sure how to create san intermediate table between two tables.
For instance, I have table called users and tables called Events. A user can subscribe to events. So I want new table UserEvents, which has user_id and event_id. Also, how would I retrieve all events added by user? In other words, how to do joins in Backendless?(I suppose there is no joins and everything much simpler though).
Thank you very much!
There are two separate questions at hand here:
How to create relationships between objects?
How to load objects created by a user?
Let's start with the first one:
How to create relationships between objects?
When you work with Backendless it is important to think in terms of objects and not tables. For example if there is an entity called Order and it contains a collection of OrderItem objects, then THAT is your data structure. You do not need to pre-create tables in console – Backendless will do it for you the very first time you save an Order object which has a collection of OrderItems. However, if you would like to do it by hand in our Console, here are the steps:
Login to console, select an app, click on Data
Create table Order (it is better to name tables in the singular form - so Order, not Orders).
When you create a new table (click the "+" button in the lower-left corner), console will prompt you to switch to Schema Editor so you can add some data columns. A column would correspond to a property in the class which represents a record from the table.
Now that the Order table is in place, repeat the process for the OrderItem table.
Once both tables exist, we need to "link" the tables together. That link would establish a relationship which can be either one-to-one or one-to-many. To do this, select the Order table and click the Table Schema and Permissions red button in the upper right corner.
Click the Add Relationship button.
In the popup that appears, you will need to create a property which will contain a collection of order item objects. Name that property "orderItems" (it is okay to make it plural here). On the right side of the popup select the OrderItem table. In the Multiplicity drop-down select Many.
Click Save. At this point the relationship is established.
To see it working you can either use the code generation module which will give you all the source code for working with the tables. Click the Code Generation icon. In the Android section, select either Eclipse or IDEA in the IDE block, then click the Java classes for defined data tables option. Click Download Project. Backendless will generate a ZIP file with the source code for the client-side classes that will let you perform a full CRUD (Create, Retrieve, Update, Delete) range of operations on your tables.
The documentation describes how to work with related data. For instance, see the approaches and API for retrieving related objects.
Things are simpler when it comes to the question of how to load objects created by a user. So we come to the second question:
How to load objects created by a user?
The approach described above works equally well for linking the built-in Users table with any other table. However, specifically with the Users table, that link/relationship is not necessary. The reason for this is Backendless automatically tags any created object with the ID of the "owner", that is the user who created the object. That "tag" can be seen with the special ownerId property in the Users table. To enable retrieval of the objects which belong to the user, we need to modify the security permissions for the table which contains the objects created by users:
Login to console, select your app and click the Data icon.
Select the table with the objects created by users.
Click the Table Security and Permissions red button in the upper right corner of the screen.
Click the Role Permissions menu item.
Locate the cell at the intersection of the Find column and the AuthenticatedUser row. Click the cell until you see a red cross.
Repeat the previous step for the intersection of the Find column and the NotAuthenticatedUser row.
At this point you restricted all access to your table for both authenticated and not-authenticated (guest) users. The next step will allow the owners to retrieve the objects which they created.
Click the Owner Policy menu item.
Click the cell in the Find column until there is a green check mark.
At this point when you call any of the Find methods on that table, Backendless will return only the objects which belong to the currently logged in user.

Implement security for sharepoint lists

I have a share-point list with which I want to implement three things:
Freeze some columns so that their data can be edited by specific people only like the ones within site owners group with full privileges.
Hide some columns according to some user groups. Earlier I did this by creating two views, one with limited columns selected and visible to all and one with all columns with filter Restricted_user = [Me] and I have put all users' names from active directory in that field, but I guess it has security loopholes like someone could see all row data by selecting view item and everything in that row will be visible to him.
2.1. If my own second option approach is selected can I implement this comparison with group aliases, rather than individuals so that I have to put only group aliases in that column field, rather that all names in that group aliases.
Last but not the least can i break up list rows into two categories so that two different groups can access and edit their own data only.Eg. 20 rows are there 5 accessible to group1 and 15 accessible to group2 but they cant access each others data rows.
Apologies for long question.
The most secure way to accomplish #3 is using item level permissions. Less secure ways include custom views and audiences.
For #1 and #2, you will need to create custom field types. Out of the box SharePoint list columns do not support column based security.

Resources