How can i add one point to user after to press the button?
20 views
Skip to first unread message
Mike Ru
unread,
Apr 20, 2017, 3:18:24 PM4/20/17
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Django users
I have Model. class UserProfile(models.Model): user = models.OneToOneField(User, related_name='userprofile') points = models.IntegerField(default=0) city = models.CharField(max_length=30, blank=True) about = models.TextField(blank=True) avatar = models.ImageField(upload_to='avatars/', verbose_name='Изображения', blank=True)
For example, if the user(authenticated) presses the button in an HTML file he wiil add one point. How can I do it?
ludovic coues
unread,
Apr 21, 2017, 2:58:31 PM4/21/17
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to django...@googlegroups.com
You can use ajax to create a request to a view that will add one point
when the user click on the button.
You can put the button in an iframe, make the iframe go to a view that
will add one point and display the button.
You can make the user go to a view that will add one point then go
back to the previous page.