Okay, let me make sure I understand this correctly. This is, essentially, the flow of control you'd like to implement:
1. User signs in successfully
2. User is prompted to some other (any other) page
3. User is presented with a one-time only popup
The simple way to implement something *similar* to this would be using the Django Messaging Framework. Of course, this framework will not (without a huge hack) do exactly what you want. However, you could most likely take the basis of the Messaging Framework and implement similar functionality, yourself.
Without looking myself, I imagine you'd have a data structure that would be stored in the user's session and a custom template tag which would look for this particular data. If that custom template tag finds the data, it does *something* (display popup, or whatever logic you may need specialized there). Then, simply put this custom template tag (or possibly variants of this tag) on your templates which may need to provide this functionality.
Here's a link for the messaging framework, just in case your not familiar with it: https://docs.djangoproject.com/en/dev/ref/contrib/messages/ -- Again, that's not the proper use of the messages framework but at an abstract level I picture it following a similar path.
To try and clear up some of the questions/issues you mentioned specifically, read below.
-- On Wed, Aug 1, 2012 at 9:44 PM, Larry Martell <larry.martell@gmail.com> wrote:
>>
>> Another issue with this is that I only want to display the pop up
>> once, immediately after they login. I don't think I can tell if that's
>> the case in the view, only in the code that is called after login().
Using the technique described above, this would happen programmatically because the template tag would simply "pop" or delete your data after it is used. The next time the template tag looks for that same data, it won't be there; unless the user logs in again.
>
> So what I ended up doing was to add a session-cookie with the
> popup-information. I can then access in the base template, but the
> issue I am having now is that they want the popup to be on top of the
> login screen, and it's displaying on a blank screen, after the login
> screen is cleared. ARHG!
Sorry but I'm not quite following you here. Can you give us more information about your "blank screen"? Also, could you clarify what you mean by "the login screen is cleared"?
So it would appear there is no way to send data from django to the
browser that updates the page without first clearing it. Is that true?
I'm a bit vague on this one, as well. However, there is no way to send data from django to the browser after the page has loaded. I'm not sure what you mean by "without first clearing it". You could always use AJAX but I don't think that's the problem at hand, here.
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment