I have a simple webpage in Django for an iPhone app. I want the user to review our product, but just one time. I do not want to show that sign again again.
To do this, the best practice to implement this will be to add a new entry in the user profile model with the bidding field: "Reviewed" - and then the user completes the action Set that flag?
Then I will check to appear in that template or not, prompt.
I have not worked yet database model, user model extended or saved in custom DB field, so any thoughts or examples will be welcomed on this. I'm a bit upset because my site is a live user and I do not want to break user tables.
If you are using MySQL or PostgreSQL, then you see some optional table
without losing any data.
In Django, it is quite easy to add a profile for the user. Make sure the profile does not exist:
Try: Profile = request.user.get_profile () Excluding UserProfile.DoesNotExist: # if DoesNotExists, create an empty profile = UserProfile (user = Request.user) profile.save ()
More info here:
No comments:
Post a Comment