models.py:
class Like(models.Model):
event = models.ForeignKey(Event)
user = model.ForeignKey(User)
class Meta:
unique_together = ("event", "user")
Now you can count Likes for a given event
likes =
Thanks ! I'll get to work on that and see how it goes!
On Monday, August 25, 2014 8:26:35 PM UTC-4, Tim Chase wrote:
>
> On 2014-08-25 17:00, amarshall wrote:
> > Hmm, That may work. I should have also noted one thing. I'm
> > actually using Django as the backend for mobile application. Both
>
On 2014-08-25 17:00, amarshall wrote:
> Hmm, That may work. I should have also noted one thing. I'm
> actually using Django as the backend for mobile application. Both
> *Android* and iOS. So I'd like to do something like this, in the
> simplest matter:
>
> pseudocode:
>
> get
Hmm, That may work. I should have also noted one thing. I'm actually using
Django as the backend for mobile application. Both *Android* and iOS. So
I'd like to do something like this, in the simplest matter:
pseudocode:
get information from the server.
if this_user HAS NOT
The other way would be to simply wire a cookie to user's browser and use js
to disable the the like button if the cookie is present if you can get away
with it. Not sure if you need to store that info against the user to see
which items they liked...
On 26/08/2014 8:41 am, "amarshall"
Hi,
I'm trying to implement likes on a Model in which 1 user will be able to
like an a model (named "event") "once" and only once.
so, I have a model like this:
class Event(models.Model):
user = models.ForeignKey(User)
. #other fields
.
likes =
6 matches
Mail list logo