How to Assign States to Viewers of Django Web Application? - django

Problem Statement
I'm working on building out a single-page Django web app and am trying to implement the following functionality:
- All viewers of the page are associated with a state. There are buttons on the page which enable viewers to change their state.
- The application stores a list of all current viewers of the page, and their associated states. Whenever a user changes their state, this stored list of viewers updates with this new information.
- The application should display how many people are online (viewing the page) at a given time.
Blockers
I'm unsure of how to collect a list of all current viewers of a page in Django, nor how to collect how many users are currently viewing the page.
Ideally, my application would not require a login to use: therefore, I'd rather either associate viewer state with a user object that doesn't require sign-in, or not associate viewer state with a user object (I'm still new to user objects though, so forgive me if this point doesn't make complete sense).
What I'm Looking For
A discussion of higher-level strategies which I can use to implement this functionality, or other places to look to gain insight in tackling my problem. I'm pretty new to Django, so I'd appreciate it if answers also direct me to locations in my Django project which are of relevance (e.g. "Consider doing X in views.py, then..."). Alternatively, if there are GitHub projects you know of with similar functionality, if you could direct me to them to investigate further, that would also be appreciated.
I'd be happy to offer further clarification as required. Thanks in advance!

Related

How to customize mobile device detector?

I have a customize request from my client in sitecore mobile module.
I want to be on full view site from my mobile on Career page, i am able to do it but any of the link inside career page with having mobile layout in presentation detail is taking that page again to mobile device.
Can we make any customization that maintain the device in cookies so that it keep user on full view site after coming to career page.
Is there any setting we can do in pipeline or session. I just want to be throughout in full view site after coming on career page and no going back to mobile layout. Kindly suggest.
Yes, you can do exactly that. You'd need to update the rule to detect the various devices (which I'm guessing you already have). You can then create a custom condition to check if cookies have been set for the full site(does not need to be a cookie of course, but that'd be the easiest way).
You can find the existing Conditions and Actions here in the path /sitecore/system/Settings/Rules.
To create custom conditions and actions, please read the following article on SitecoreInsight.com
After creating your custom condition, go into your device item again and update the Rule there to only switch to that device when that cookie has not been set.
[edit]
Come to think about it, it might be possible to have your 'go to full site' link appended with a querystring sc_device={GUID of device}. I'm not sure what would take precedence here, the 51degrees rules or Sitecore's cookies... Worth a try though :-)

Alfresco Share Customization Limitations

We have chosen Alfresco for our project because Alfresco meets most of the functional requirements we need.
Share is a great app, nevertheless it has too much functionality for our scenario, much more than we need in our project. This is the reason of posting this question, we don't know what's the best option: either customize Share creating custom pages, custom dashboard, custom actions and metadata etc. or create a new web application that interacts with the repository.
Roughly, we have these requirements:
Custom header with custom menu, disabling direct access to Repository (users only can collaborate using Sites)
Custom dashboard that contains
On the left, list of Sites
On the center, custom dashlets which shows several content in different ways and formats
One of the dashlet would be a "dynamic" dashlet as I explain in my last question
Custom document details page, with custom actions and custom metadata
I would like to know opinions based on experience, explaining when and why would be a good idea to create a new web app that interacts with the Alfresco repository or when to customize Share according to your needs. I'm highly interested on knowing Share customization limits.
Thanks.
Alfresco Share doesn't really have any limitations, it's already an UI built upon the repository.
I've seen Share modification till the sky and one can't even see it's Share any more.
The things you've described above are just templating and building the rightfully freemarker templates/js to view the piece of information.
If you take a good look at the default templates with their regions and shift around the default regions you'll see that you don't need heavy customizations to achieve a different layout.
The only thing one probably lacks is experience with Share.

Sitecore: tracking of the last visited page

On the site that I'm developing we need to track the last visited page for each user (users login to the site). What's the best way to do this? We are already using a custom profile so adding a new field is easy. The site will not have a lot of traffic so updating this field wont be an issue, i think. Are there better ideas? Does sitecore already offers something that we can possible use?
OMS has a "Top Exit Pages" report by default... but that is tracked across sessions, not users.
A good IIS log parser should also be able to give you this information... again, that would be by session (or IP) and not logged in user.
If you really want to get every exit page AND filter by logged in user... what I would do is add a new pipeline processor to httpRequestBegin, and place it after the ItemResolver. Then save the Item.Paths.Path. I would advise against writing this data to the user Profile if you are using the default ASP.NET Profile handler and you have a decent amount of traffic, because it is highly inefficient. Roll your own simple storage solution here, or just dump the data to a log.
My first question would be: Why do you need only the last visited page of the user? What are you trying to determine?
In a lot of cases, you are probably starting down an analytics route, or perhaps even trying to drive some marketing.
If the analytics is what you are going for, you can probably just pop an event out to your google analytics account with the current username as an event variable to allow you to look at analytics by user and by page. Alternatively, you could use the Sitecore OMS/DMS features for tracking all that data and looking at the analytics there.
If you are looking at driving marketing, you probably want to use OMS/DMS, especially if you want to start getting into personalization or engagement plans. OMS/DMS will track user activity, and all the pages they visit, though not by user account. With some customizations, you can probably add that data in, but it will depend on what you are trying to use the information for. The username may not be what is important to you.
If, however, you just want to know what page to send the user back to after logging them in, it would be better to just store that in session or pass as a post parameter if session is not a viable option for you.

Can customer open graph objects be used in multiple sites?

I'm not sure the best way to ask this, but is it possible to reuse a custom object type defined in one app so that it aggregates on the timeline with objects of the same type from another app?
I see news articles doing this in my own timeline, such as Guardian and Yahoo news articles appearing in the same aggregate box. I'd like to do this with my main blog as well as another blog project, both of which are about puzzles. Since I have the object type defined as thegriddle:puzzle in my app, can I use that object type with a second app in order to make the items aggregate together? (i.e. "Solved Puzzles" listing puzzles solved on The Griddle and on the second blog)
I have run into the same concern and have found no way around the limitation of 1 app -> 1 domain.
You may have some luck if you associate the Website URL to one domain and the Mobile URL to another. But to be honest that is silly and probably doesn't even deserve being mentioned.
So as far as I can tell, the answer is no, not at this time. Although I hope this issue is resolved soon. Maintaining 4-5 apps / submitting action object approval for each is a timesink.
As far as two items from different apps showing up in the same stream - that could be because they are grouped by opengraph actions or objects.
References:
Facebook open graph timeline application - How to connect/use other objects in your own timeline application
Personal experience.

Should I use Django's Admin feature?

I'm building a Django-based review website where public users create all of the content on the site. Users create reviews for given items and they also create the items themselves that will be reviewed (providing a description and brief summary of the item, along with a few tags).
My question is this: Should I be using Django's admin features for this website (as in, exposing admin controls to the public users)? Or should I just stick with normal forms? I'm not too familiar with the admin-aspect of Django, and so far I've just been using forms for the website, but I've seen a lot of people talking about Django's admin features, and I'm starting to wonder if I should be using them.
Thanks for any feedback!
Maybe. If the admin functionality covers most of what you want to offer, there's no reason why you shouldn't use it as a starting point.
django.contrib.admin is an application like any other, and provides basically a CRUD interface to your models. Access can be controlled via groups/permissions, just like you would for an application you write yourself. You can give full access to a model with a one-liner, but obviously will have to configure properly when opening up to others.
See also my question
Django AdminSite/ModelAdmin for end users?
and similar questions Exposing django admin to users. Harmful? and How to make Django admin site accessed by non-staff user?
Regarding arguments about the "intended use" of the admin, please note Django's security update at the end of last year: http://www.djangoproject.com/weblog/2010/dec/22/security/ regarding querystring parameters in object lists. Such an update (quote: "an attacker with access to the admin [...]") is a clear indication that the admin's implementation of the permission system is being constantly scrutinized.
No. The django admin is not intended for any end-user.
The django admin feature is intended to assist the website developer, and that is all. Even usage by site administrators is contra-indicated, although in practice most small sites get away with it since they're only talking a few people who can call on the developer personally if they get into trouble.
For your purposes, the review items and the workflow in creating the items is a critical part of your application feature set. The admin will give you ideas, but it would be a mistake to attempt to build your application upon it.
I wouldn't expose the admin interface to regular users. You can use the authentication and user-management side (for your purposes), but it's usually best practice to give users a separate way to manage their objects. You also don't run as much of a risk of granting the wrong privileges to users (or allowing them to grant their own).
Have a read though the docs if you want a better overview about what it can do.