I have developed a website having functionality such as writing,posting ,user profiles, events & activities, offers..etc.I need to add one more functionality and i.e. Automatic push notification to the users about activities & events, offers and discounts (facebook like notification).
What I want to do is to inform users in their profiles, whenever admin/staff add their events & activities and offers or if user are updating profile, then inform the user of that update. I have looked around many applications but I am still very confused about how to do it.
I really need some proper tutorial or guidance on how to go about doing it. I know how to register a notification and send it on proper signal but there is no documentation on how to show these notices in a template, if this can be done.
Related
Newbie with Odoo..
I am using the Events module for creating an Event Management Platform.
The registration process is clear however, I want to customize it a little bit.
Instead of sending a link and the user chooses a specific ticket then a modal pops up, I want to send directly a link containing a form for registration without other details.
In another words, How can I make a separate form and make it for event registration ? or is there any other workaround ?
I have just integrated Stripe Checkout with my Django app. However, from their code:
session = stripe.checkout.Session.create(
customer_email=customer.email,
payment_method_types=['card'],
line_items=line_items,
mode='payment',
success_url='http://127.0.0.1:8000/SUCCESS/?session_id={CHECKOUT_SESSION_ID}',
cancel_url='http://127.0.0.1:8000/cart'
)
It redirects to a Success_url. I would like to display their order info and send an email from the success page but currently, everyone can visit(would cause random emails etc). Is there a way i can limit this for the person that just checked out? Thank you!
The success page should really just be a page to let your users know that their payment went through. I wouldn't personally recommend triggering any app-specific logic when your users land on it. As you've pointed out this could cause accidents with users randomly stumbling on that page and triggering emails. It also offers an opportunity for bad actors to exploit your application.
Instead, I would create a webhook endpoint and listen for the checkout.session.completed event, and trigger your emails from there. Building a webhook endpoint should be no more difficult than building any other endpoint on your server, with there only being some small extra logic to verify incoming requests.
Another option would be to use a tool like Zapier to listen for these events from Stripe and trigger various flows from them: https://stripe.com/partners/zapier
I'm looking for a django app that would allow superusers to add, update, disable users, and to choose which group would this user belong to.
I have looked at different solutions:
Creating another admin site, with only user management registered to it.
django-user-accounts
django-userena
Those offer's very good solutions, but I'm looking for a simple interface for my users so I can't add another admin site.
I'm looking for simple create user, disable user function from the font-end of the system.
I suppose I can just go ahead and code this one but I wanted to check if there is any app that is available first.
Thanks in advance
For further reference so those who come across this post can benefit, I have searched for more than a week for a simple, and quick user management app.
There are two notable solutions advanced solutions first django-user-accounts it handles:
User activation
Forget Password
Sign up
Email confirmation
Signup tokens for private betas
Password reset
Account management (update account settings and change password)
Account deletion
second notable solution is django-userarena it handles
signup
signin
account editing
privacy settings
private messaging
having a back-office solution that only administrators are offered the ability to create a user, enable/disable them. I was only left with the solution of creating my own code, which is not bad, but I was hoping to find an easy, and tested solution.
Maybe if somebody is interested I can upload it someday.
Thanks
I am new to Celery and I can't figure out at all how I can do what I need. I have seen how to create tasks by myself and change Django's file settings.py in order schedule it. But I want to allow users to create "customized" tasks.
I have a Django application that is supposed to give the user the opportunity to create the products they need (files that gather weather information) and to send them emails at a frequency they choose.
I have a database that contains the parameters of every product like geographical time, other parameters and frequency. I also have a script sendproduct.py that sends the product to the user.
Now, how can I simply create for each product, user created a task that execute my script with the given parameters and the given frequency?
As you know how to create & execute tasks, it's very easy to allow customers to create tasks.
You can create a simple form to get required information from the user. You can also have a profile page or some page where you can show user preferences.
The above form helps to get data(like how frequently he needs to receive eamils) from user. Once the form is submitted, you can trigger a task asynchronously which will does processing & send emails to customer.
I'm looking for a way to keep track of users that are online/offline. So if I present all users in a list i could have an icon or some kind of flag to show this. Is this built in in Django's default Auth system?
My first thought was to simply have a field in my profiles called last_logout in the models and update it with the date/time each time user logged out.
With this info and the built in last_login I should be able to make some kind of function to determine if the user is loggedin/online right?
Or should I just have a boolean field called "online" that I can change when user logs in and out?
With only django it will be hard to do. For such task async frameworks are more suitable.
For example, tornado.
Users won't do logout explicitly every time they go offline. They just close their browser and that's it. You can't know it with only django auth app. It is not designed for such tasks.
Even if you will check for not expired session, it not gives you all online users, because session can be non-expired for 30 days.
So to get real online users, possible solutions are:
Every user will send some data via javascript to your server, for example every 10 seconds. You can fetch that data on server and put user into cache and set cache key to be alive for 10 seconds. So when you need to know, who are online now, you'll check your cache. But it is not a good solution, because it will need a lot of server resources.
Use async framework (tornado) at server side (you can setup separate process for exact requests). And use websockets (SockJS is a good library for that at client side). It is a more complicated solution, but it is better.
You have to consider what exactly means for the users to be "online". Since any user can close the browser window any time and without the server knowing about that action, you'd end up having lots of false "online" users.
You have two basic options:
Keep track of the user's last activity time. Every time the user loads a page you'd update the value of the timer. To get a list of all online users you'd need to select the ones with an activity before X minutes. This is what is done by some web forums.
Open a websocket, long polling connection or some heartbeat to the server. This is what Facebook chat does. You'd need more than just django, since to keep a connection open another kind of server-side resources are needed.