Quantcast

How can i add one point to user after to press the button?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

How can i add one point to user after to press the button?

Mike Ru
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?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/97ba4189-7d02-4d8d-9be9-7e93ea52a2fb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How can i add one point to user after to press the button?

ludovic coues
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.

2017-04-20 21:18 GMT+02:00 Mike Ru <[hidden email]>:

> 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?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [hidden email].
> To post to this group, send email to [hidden email].
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/97ba4189-7d02-4d8d-9be9-7e93ea52a2fb%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



--

Cordialement, Ludovic Coues
+33 6 14 87 43 42

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAEuG%2BTZbPfRE_N-%3DNX9mLcqirJj%2Bn%2B_BznompmeBGs2XZ4E9Yg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Loading...