0

I have been working around this problem. I have a user submitting a HTML form lets say to list their hotel on my website. I need to review this form before i add it into my hotels model to be published. One approach i have worked on is to use a requests model where this form can be stored and later using django admin action write a custom action to add/remove the request. In case of acceptance i copy the details to my hotels model else it sends an email or a notification back to user.

Second approach is simply using django action on hotels model where the request is sent to approve it or reject it. In this case i want to know if thats possible where a data point doesn't get written to database until it's been accepted by admin. If yes how can i do that?

Finally, these details are displayed on my main page and search page for users to book these places.

If there is a better and effective way to do it. Please share that.

Thanks in advance. If something isn't clear i can answer your specific questions in the comments below . Have a nice day.

1 Answers1

2

You can have is_published Boolean field in your hotel model and you can default it to false initially. After you inspect the hotel details you can set the is_published field to True from django admin.

So now whenever you are querying for hotels to show on your website. You can query Hotel.objects.filter(is_published=True)

Arpit Svt
  • 1,153
  • 12
  • 20
  • thank you :). If there is anything further during my implementation i would post it here. – Erlich Bachman Aug 06 '19 at 06:49
  • 1
    Sure I will be happy to help. – Arpit Svt Aug 06 '19 at 07:24
  • Hi, my form has images of these hotels to be uploaded while user submits the form and they need to be "held" somewhere maybe before admin confirms the request to post their hotel details. I am using Cloudinary as image hosting. Is there anyway i could hold these images before the request is confirmed? i am thinking of using a temporary folder for images after the request has been confirmed they also get moved to main images folder. – Erlich Bachman Aug 10 '19 at 02:50