Questions tagged [updateview]

28 questions
2
votes
1 answer

Django testing UpdateView - object has no attribute 'object'

I am trying to write a test for an UpdateView I created. My view looks like this: class MutantUpdateView(UpdateView): context_object_name = "mutant" fields = ["mutation_level"] model = Mutant pk_url_kwarg = "mutant_id" …
UpDawg
  • 51
  • 6
2
votes
1 answer

How to access a Django UpdateView with using a uuid as slug

I'm wondering on how I can access a UpdateView by using a uuid as slug. So my goal is an URL like http://myapp.example.de/edit/7efdbb03-bdcf-4b8a-85dd-eb96ac9954fd I have defined the the view like this: class DeviceEventUploadView(UpdateView): …
frlan
  • 6,950
  • 3
  • 31
  • 72
1
vote
1 answer

in Django, how can i pass data from a DetailsView class from a form in a UpdateView?

Im doing a "To Do" list in Django, the problem is that im trying to make a update in each task, but when i click the button "Actualizar" (Update), i want the form in that view comes pre fill with details of the task im updating (like title,…
1
vote
1 answer

form_valid method not called if post method not overridden

I have a blog that is composed by user's posts and post's comments. In my UpdateView, the model points to Post, so I can show the post in the template. In my form_valid method, I get the comment from the user through a form. The problem is that if I…
1
vote
1 answer

Django UpdateVIew is not working with form_class

I need to edit an existing form and make changes to the database. So to do this I use UpdateView based class. When I use 'fields' everything works correctly, but there are no styles applied to the form, so I'm trying to use 'form_class' instead and…
Akim
  • 11
  • 1
1
vote
1 answer

How to change texts in Fragments?

I want to change texts in fragments, but I keep getting error like this java.lang.NullPointerException: Attempt to read from field 'android.widget.TextView com.javahelp.databinding.FragmentHomeBinding.Aboutus' on a null object reference in method…
1
vote
1 answer

Swift/SwiftUI - Unable to update binding value programmatically for RichTextKit's RichTextContext

I'm utilizing Daniel Saidi's RichTextKit in my app to allow for rich text editing. https://github.com/danielsaidi/RichTextKit I am having trouble updating RichTextEditor(text: $value1, context: value2) programmatically via a function. I'm wanting…
1
vote
1 answer

How to allow UpdateView only to a user that owns that model - and that model is already connected with a foreign key

I want the Topping model to only be accessible to a current user, and not to other users who could access that page by copying the URL. models.py class Pizza(models.Model): name = models.CharField(max_length=20) owner =…
1
vote
1 answer

Django - Can I use one UpdateView to update fields on separate pages?

Let's say I have a Student model, with name and age fields, and I have a page with a DetailView class showing these fields. Let's say that rather than having one "update" button that will take me to a form to update all fields of my model at once, I…
moonybaby
  • 33
  • 3
1
vote
1 answer

SwiftUI Switch Statement Transition Behavior is not as expected

I am getting unexpected .transition behavior when using a switch statement to update the View vs. when using two if statements. The two if statements are sliding the views back in and out as expected, however, the same transitions in the switch…
0
votes
0 answers

The update on the address field isn't working

I'm working on a Python/Django project. In the update view, I'm encountering a very specific issue: When I try to update the bank_account field, the system updates it without any problems. However, when I attempt to update the address field, the…
Ozzyx
  • 1
  • 1
0
votes
0 answers

Beginner: Django todoapp- update view(funcn based). I am able to update, returns back to home page but shows old data itself instead of updated data

I am building a todo app with two forms - UpdateForm and TodoForm, using Django. I tried two types of function codes, but was not able to get the desired result. With the first type of function code, I was not even able to update, but with the…
swapna
  • 1
0
votes
1 answer

Django basic form submits successfully, but it doesn't update the datebase

As a test run after reading through Django for Beginners, I am trying to make a server with custom D&D character sheets. Here is my the relevant fields in my model (keep in mind that I have other fields, I just didn't list them for…
0
votes
1 answer

Interaction between UpdateView, ModelForm and URL

I really don't understand what I'm doing wrong. I am trying to create a view in which it will be possible to update information about the model object. I do this using UpdateView and ModelForm. Here is the form that inherits objects from the…
mrrapi
  • 3
  • 2
0
votes
1 answer

Django UpdateView does not validate form fields, and does not update

I have created the following Django UpdateView: class ProfileSettingsView(SuccessMessageMixin, UpdateView): template_name = "accounts/settings/profile_settings.html" form_class = ProfileSettingsForm success_message = "Your profile has…
Scratcha
  • 1,359
  • 1
  • 14
  • 22
1
2