I was trying to get a filter feature for my admin, otherwise it is tough to find the value the data-entry would need to find. Something like this:
I found that in https://demo.django-blog-zinnia.com/admin/zinnia/entry/add/ (the login info for the site is user: demo, pass: demo)
Use Bootstrap-Select Multiple
This is a simple JQuery plug-in that will enable you to select multiple values of data as you have shown in the demo link.
This also gives you the options to search the data-set
In my opinion, this is a bit better for the UI than the style you have shown.
Related
I am trying to do some reporting on page views on a site and the results are being listed like the following:
www.example.com/directory/ - 100 views
www.example.com/directory/?id=123456 - 10 views
www.example.com/directory/?id=987654 - 5 views
What filter do I need to create to views the results as:
www.example.com/directory/ - 100 views
www.example.com/directory/?id=* - 15 views
Thanks in advance
Yes, getting historical grouped together is going to mean using something like Google Docs, Excel, Tableau Software, Analytics Canvas, etc.
Moving forward...
One of the simplest ways of keeping things grouped in GA is to set up an advanced profile filter. You'll want to use this with a new profile; keeping a "raw" or "empty" profile is highly advisable for when you actually want to look at those individual URLs.
That said, here's a filter pattern that should work for you:
Go to Admin > Filters (under the View Column)
+ New Filter > Create new Filter > Name it
Filter Type = Custom filter > Advanced
Here's the pattern:
Field A: www\.example\.com\/directory\/\?id=.+
Output To: www\.example\.com\/directory\/\?id=\*
Another way to aggregate the same URI with multiple query strings is to change the primary dimension to 'Page Title' under Behavior > Site Content > All Pages.
The best way to do this for your historical data is unfortunately in an excel pivot table. You can get in in the UI, but only by creating a custom report and searching for very specific directories.
Check out the documentation on excluding query strings in your GA profile. Maybe create a new profile and write an advanced rule to rewrite all "id" pages to "/directory/product-page".
A totally different approach is to use custom variables or custom dimensions and to stop looking in the normal "Behavior" reports section (used to be called "Content" in GA) – custom dims are available using Google Analytics Universal Analytics only, which means starting a new web property and possibly running both code snippets concurrently (totally safe to do).
Personally I find custom dimensions a bit easier to work with than custom variables, and I generally think that it's a good idea to start exploring the new Google Analytics.
The nice thing about either of these approaches is that you can still keep the full page path date in the same profile as your custom dimension / variables information; it'll stay in the Behavior section where it belongs with all the other page paths.
Where I'm going with this...
You can create a new dimension such as "page type" and then call it "products", "posts", "articles", or whatever these id #s represent in this /directory/; then you can look at metrics across the dimension like pageviews, time on page, etc. by page type.
You can even create other dimensions to help describe them in more detail, such as breaking down blog posts or products into their different categories; i.e. hierarchical dimensions. Once you start using this kind of thing you may wonder what you ever did without it!
I think it's fair that I stop this answer now since it's not about how to set up custom variables or custom dimensions; those links should get you started (it's really not difficult).
Note: You can use php to fill in the dimension information in the GA tracking snippet dynamically based on the page that is being viewed (again, that's another question).
I have a test profile in my google analytics account, and ultimately I'd like that profile to include all of the following:
all requests to the test.mydomain.com subdomain
all requests that include "test.mydomain.com" somewhere in the URI
all events that include "test.mydomain.com" somewhere in the category
I had originally tried creating 3 filters on that profile (one for each of the above), but it appears that google-analytics profiles only include things that match ALL filters.
I tried using an advanced filter to combine the above 3 items together into one field, so that I could then just search that field using a regex, but I'm not having much luck... Here's what I have so far:
Filter 1:
which should result in "|test|test" being placed into Custom Field 1 (assuming I had "test.mydomain.com" somewhere in the event category and "test.mydomain.com" as the Hostname)
Filter 2:
which should result in "|test|test|test|" being placed into Custom Field 2 (assuming I had "test.mydomain.com" somewhere in the Request URI).
Filter 3:
which should make it so my profile includes all items where "|test|" appears somewhere in Custom Field 2.
Unfortunately, that's not working, as my test profile is always empty. My "include everything" profile is showing that my requests are coming through and that the do include "test.mydomain.com". I've tried other variations of the above filters, such as setting my advanced-filter regular expressions to ".*", so that they simply concatenate the full Category, Hostname, and Request URI together into Custom Field 2 and then adjusting filter 3 accordingly, but still nothing comes through on that profile. I understand that changes made to profiles can sometimes take a couple of hours to start showing up (https://support.google.com/analytics/answer/1638635?hl=en), but my test filters have been set up for days, so Google should have applied them by now.
Does anyone have an idea what I might be doing wrong? Am I just misunderstanding how the advanced filter works?
Does anyone know of a way to inspect the value of "Custom Field 1" and/or "Custom Field 2" so I can see if those are being built correctly?
You can accomplish this with 4 filters (3 advanced, 1 include). If any of the requirements are satisfied, write "ok" in one of the custom fields. Then do an include on that custom field that matches "ok".
filter 1 - advanced
field a - hostname
extract a - test.mydomain.com
output to - custom field 1
constructor - ok
Use the above concept for the remaining 2 conditions. Then do an include on custom field 1 = ok
I found the issue. The technique that I outlined in my original question, or the technique suggested by Andy should work fine. The problem in my specific example is that google-analytics filters do not have full support for regular expressions. In particular, they do not support the positive lookahead in my example. The other part of my issue was that I sometimes wasn't waiting long enough before testing my profile changes (google can sometimes take a few hours before applying the changes).
To see what regex options google does support, see https://support.google.com/analytics/answer/1034324?hl=en. I originally thought that page was a "getting started with regular expressions" page, but, apparently, that might be all of the regex language that google supports.
If you are unsure if there are parts of your regex that google doesn't support, you can test it on the google-analytics site directly, and in realtime on live data (without waiting for google to apply your profile changes), by navigating to Content > Site Content > All Pages in your Profile, then click on "Advanced" at the top of the "Primary Dimension" table, then change the match type to "Matching RegExp" (see https://support.google.com/analytics/answer/2936903?hl=en). There you can enter in your regex, and if google doesn't support part of your regex, it will tell you immediately when you click "Apply" (not sure why they don't include that regex validation on their profile filter page...). You will also be able to see it immediately filter the content of that table.
I want to implement a report section in Django admin. This would mean adding a custom section in the admin homepage where instead of a list of models I would see a list of reports. I want to use Django's admin tables with filters, sorting, everything if possible.
What would be the "best" way of achieving this? I realize this is a "big" question so I'm not asking for code snippets necessarily, a summary of needed actions would be just fine :)
P.S. Be report I mean a "made up" model by custom queries (queryset or how it's called).
P.S.2 Maybe this question should be something like: How to use Django admin tables functionality in own admin view?
P.S.3 Or maybe there is a way of providing to the existing admin interface my own data. This way I don't have to do anything else. I just want to say instead of a model take this data and display it in a nice table which I can sort, filter etc etc.
So you are attempting to add in new pages into the django admin.
This section explains to you exactly how you can do so - https://docs.djangoproject.com/en/dev/ref/contrib/admin/#adding-views-to-admin-sites
The basic idea is to add in new urls that you want in your urls.py as if you are adding urls for your "front end" pages. The key difference is that these new urls you are adding should start with ^admin/ and would look something like ^admin/my_special_link_in_admin and this url will point to your own custom view function at a location you so prefer.
E.g.
(r'^admin/my_special_link_in_admin/$', 'my_custom_admin_app.views.special_admin_page'),
So this is the way for complete customization. There's a very good tutorial which I refer to here - http://brandonkonkle.com/blog/2010/oct/4/django-admin-customization-examples/
In addition, if you don't want to do too much work, consider using Django Admin Plus - https://github.com/jsocol/django-adminplus
Or a django-admin-views - https://github.com/frankwiles/django-admin-views
I want to list all components we have in our trac system on a wiki page - any ideas? I have written a report that lists them (using distinct etc. so they only display once) - can I use this?
Part 2 - we have a custom field of "client", I then want to, on a client's wiki page, list just the components that have been used in tickets for that client - again I could do this in a report but how do I get that to display on a wiki page?
Thanks,
Amy
If you can do it in a report, you can do it in a wiki page. Use the [[TicketQuery]] macro to insert a report/query into a wiki page. For example the following macro
[[TicketQuery(client=ClientA,group=component)]]
would display a list of tickets that were assigned to ClientA, grouped by component. See WikiMacros for more information about using this macro.
If you need to do more advanced queries, you can use plugins like the SqlQueryMacro or WikiTableMacro to allow you to write query the database directly (there are probably other plugins that do this sort of thing as well, these are just the ones that I can remember offhand).
To generate a list of your project's components, try the ComponentsProcessorMacro.
You can convert the report to a query and integrate that in the wiki page, see for example TracQuery - Customizing the table format
[[TicketQuery(max=3,status=closed,order=id,desc=1,format=table,col=resolution|summary|owner|reporter)]]
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.