I am trying to create a simple app that forces the user to enter a reason for update or delete when they are editing an existing model through a form. I have created the model and the associated form. The part of the model that asks for the update summary works fine, but when it appears, it obviously always has the last update that was entered for the model as part of the update view. Is there some way I can "blank out" the update summary every time? I am also trying to create a history of each form and I'm still in the early stages of that. I see that there are several options available, but I'm still exploring those. I'm a newbie, so any help you can offer is appreciated!
Here is a copy of my current model:
class Pizza(models.Model):
pizza_name = models.CharField(max_length=264,unique=True)
customer = models.TextField(max_length=264,unique=True)
update_summary = models.TextField(max_length=264,unique=True,null=True)
I have explored possible using Javascript to blank out the form in the update view but can't seem to get that to work. I have also considered trying to override the form in the form view, but can't seem to get that to work either. I ultimately want the update view to show the pizza_name every time as well as the customer view, but I want the update_summary to be blank every time. I intend to store every update summary on a separate history record to be viewed in a history view somewhere but am working to figure out how to best approach this as well.
Thanks in advance for your help!
Related
Bit of a broad question however I'm sure someone can offer me some sound advice!
I am currently developing a form which is presented to a user over several views/states. A user fills out the first section, clicks 'next', state changes and the next part of the form appears etc...
When the user goes to submit the form on the last state and they have made some mistakes in the first or second state, would it be possible to have them redirected to the sate in which they made the error, and focus on that field?
I ask simply because I will have to implement this at some point, and do not want to go forward as planned in case this is not possible using several different states to present the form.
Each state shares the same object using a service, which is used to hold the inputted data.
Any advice would be much appreciated as always.
I have HTML and JavaScript in place that allows a user to move Django database entries (displayed in a table) up and down. However, is there a way that I can store this new order that the user has customized so that it will show up any time the user navigates back to that specific page view? I think get_queryset is what is causing the page (after refreshing) to switch back to the basic filtering. But, I have no good ideas on how to override it or avoid it to accomplish this task. Any help would be much appreciated!
I would suggest using ready solutions: django-admin-sortable or django-admin-sortable2. As for me, I have successfully used second solution and it works. One important note about it is to run ./manage.py reorder my_app.models.MyModel after adding new order field as mentioned here.
Please could someone assist with the following:
I'm trying to restrict the viewing of forms using bootstrap and Meteor. In other words, user A logs in and creates a simple (or 2, or 3...) form using a modal which then displays in the html on a panel. How do I ensure that when user B logs in, he only sees his particular forms and not "user A's" forms?
I haven't included any code as I haven't started working on this problem as yet.
Thank you.
That's something you need to deal with using your publications/subscriptions. See here and here for learning ressources.
Basically, what should happen is that when user A creates a form (or any object), you store it into a collection along with the user id (Meteor.userId()). You subscribe to a publication in your page where you send only the items belonging to the current user Id.
That should solve your problem, and make you ready for all the similar (and common) cases where you need to disclose selected information only, depending on the context or the user. Moreover, it means that your users will be able to find back the items they left in their previous sessions.
I am trying to create a list of contacts, where I have two views.
One view that lists all the contacts and gives the option to add a new contact, being a button, not an actual space where I put the information.
The other views is when I click on the plus sign, that would give me the field to put a new information.
What I am trying to do is using angular, after I put all the information in the field, have updated on the array. My idea is that since I am not refreshing the page, the array should contain the new added contact, but it's not happening.
Do you guys know why?
I could put the code here, but honestly I just want to know if what I am trying to do is hypothetically possible
Edit: Everything was fixed using a factory ;). Thank you guys.
If I get you correctly I think what you need is a service to hold the contacts, that way if you update the service your scope property for the contacts updates as well
So I've run into a small design problem.
I have a partial where you can fill in some form information, and a second partial where you can select some additional items. I store the details of the first partial in localstorage so that it can be filled back in when the user returns from the second partial (it makes sense, don't worry).
However, I want to delete the localStorage when the user leaves to any other part of the website, but there are about a dozen ways to do that. I would like to handle this with a partialClose event, but I can't seem to get it to work (I'm new at web development so forgive me if this is a stupid question).
What is the proper way of handling a partial close/switch event with both AngularJS and Jquery?
The event for a partial changing is $locationChangeStart