Questions tagged [multi-model-forms]

29 questions
5
votes
1 answer

Django - change min_length in form __init__?

Is there any way, to change the field's *min_length* argument inside form constructor? That doesn't work: def __init__(self, *args, **kwargs): super(CreateTeamForm, self).__init__(*args, **kwargs) self.fields['primary_color'].min_length = 4
tunarob
  • 2,768
  • 4
  • 31
  • 48
4
votes
1 answer

Rails Guides - Step 11 - Multi Model Form - MassAssignmentSecurity error

I'm very carefully following the RailsGuide and it's working beautifully, until Step 11. Adding Tags via a MultiModel form. Once I've added the code I get this error: ActiveModel::MassAssignmentSecurity::Error in PostsController#update Can't…
Will
  • 337
  • 4
  • 15
3
votes
1 answer

Deletion by tab button doesn't work

Several DEVICE forms can be displayed on a page (Order), as tabs. When a user closes a tab and hits save, then renters that particular Order (ID), the user still sees his deleted tab. As a quick workaround, a checkbox was built into the html code…
pymat
  • 1,090
  • 1
  • 23
  • 45
2
votes
4 answers

How to use error_messages_for in a multi-model form?

I have two models: Album and Track. Album has many tracks, and Track belongs to album. I'd like to have the ability to create as many tracks as needed while creating the album, similailiy to railscasts episode 197. Unlike the railscasts episode,…
Yuval Karmi
  • 26,277
  • 39
  • 124
  • 175
1
vote
1 answer

rails-3.1 | Is this a case for a nested form or a case for something else?

I am working on an app to be used as a logbook for aircraft. I may be headed in the wrong direction with design of my db. Any recommendations on that would be useful. Is this a situation for nested forms? Or is that only if I need to actually create…
1
vote
1 answer

Create a Multi Model Endpoint using AWS Sagemaker Boto

I have created 2 models which are not too complex and renamed them and placed them into a same location in S3 bucket. I need to create a multi model endpoint such that the 2 models have a same end point. The model i am using is AWS in built…
1
vote
2 answers

How to assign dropdown data to a field after importing data from view

I am creating a dropdown in forms.py and to filter data I am getting a variable named layer_id . And getting in view like this layer_id = kwargs['layer_id'] . All things are good but when I assign on end to filed like this …
Learner
  • 238
  • 3
  • 17
1
vote
1 answer

AJAX update of accepts_nested_attributes_for partials

My current working environment is Rails 2.3.8 (various reasons why my company hasn't moved to Rails 3). I'm trying to update elements of a multi-model form via AJAX calls - the idea being to replace certain dropdowns depending on how the user…
Pasted
  • 864
  • 1
  • 12
  • 22
1
vote
1 answer

edit django form widget rendering

I have a Django form where one of the fields is defined as: widgets = { 'name': forms.CheckboxSelectMultiple() } The template renders them in a loop with: {% for field in form %}
{{…
Flobin
  • 626
  • 1
  • 10
  • 26
1
vote
1 answer

Single CrispyForm Tabs 2 Django Models

I am trying to create a web page that displays tabs at the top. Each tab relates to more than one model. I am using CrispyForms as follows: class TestCrispyForm(forms.ModelForm): helper = FormHelper() helper.form_tag = False …
1
vote
1 answer

data inserting into database on page reload in Yii

data inserting into database on page reload in Yii I have used two models: CName and CDetails in a single form. All is working well. Except, whenever I reload or refresh that form page, empty data is being inserted into the both tables of the…
santos_mgr
  • 37
  • 1
  • 2
  • 7
1
vote
3 answers

Yii multi model with HAS_MANY Tabular form

I have been trying to find a solution to something that I believe is rather simple? What I would like to do is create a tabular form to collect some records for a survey. Table: survey_record id meter_id status_id create_time create_user Table:…
Glicious
  • 421
  • 1
  • 5
  • 13
1
vote
0 answers

Rails: Multi-model form won't write data to models

Ok this is driving me round the bend. I have three models [which are relevant to this quesiton]: Outfit, Outfit_relationship and Answer. Outfit is the parent model and the others are the childs. The Outfit model looks like this: class Outfit <…
0
votes
0 answers

Django Filters on multiple models

I am a new django/python user and I am having an issue using django-filters with related models. I have created a tutorial application for myself with two models: class Customer(models.Model): def __str__(self): return…
0
votes
1 answer

Django MultiModelFormView

I am using django-multi-form-view to display 2 model forms on the same page. I have a parent model and a student model. Student has a foreign key to parent, as I can have many children per parent. ( one to many relationship) models.py class…
1
2