= True
def save(self, commit=True):
logger.info(" Method not meant to save anything ")
pass
On Monday, June 14, 2021 at 12:09:49 AM UTC+5:30 VISHESH MANGLA wrote:
> in line 38 i have that print statement, it's output is at the top , I dont
> know why that
in line 38 i have that print statement, it's output is at the top , I dont
know why that initial data is not going into that model formset.
actually one data the PAN_ID actually went into the modelform, but the
checkbox's "checked" didnt. You can see the html of the forms
Hi, what is the best way fill all extra data inline, my code is
model.py
ModelA(models.Model):
name = charfield(...)
CHOICE_OPTION = ((1,'One'),(2,'Two'),(3, 'Three')
ModelB(models.Model):
fk(ModelA)
option = integerfield(choice=CHOICE_OPTION)
field1 = boolfield()
field2 = boo
form initial data?
I have the view like this-
The form is working good but i issue is not able to get from initial data.
PLEASE HELP
**formview.py**
class AddProfile(LoginRequiredMixin, CreateView):
template_name = 'users/add_user_details.html'
form_class = {
'con
I have the view like this-
The form is working good but i issue is not able to get from initial data.
PLEASE HELP
**formview.py**
class AddProfile(LoginRequiredMixin, CreateView):
template_name = 'users/add_user_details.html'
form_class = {
'con
>
> Maybe you mean to be creating an UpdateView with this new information
> about self.jobs?
>
>
>
> *From:* django...@googlegroups.com [mailto:
> django...@googlegroups.com ] *On Behalf Of *furzihurzischleim
> *Sent:* Wednesday, March 7, 2018 12:10 PM
> *
: Wednesday, March 7, 2018 12:10 PM
To: Django users
Subject: Re: unable to render initial data in ModelForm called through
CreateView
thanks for the link, i was aware of that but was unable to find my error
(that's why i turned to irc, and then to the list)..
it is true self.jobs is set fro
/Django/1.11/django.views.generic.edit/CreateView/
From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On
Behalf Of furzihurzischleim
Sent: Wednesday, March 7, 2018 7:11 AM
To: Django users
Subject: Re: unable to render initial data in ModelForm called through
CreateView
018 2:48 PM
> To: django...@googlegroups.com
> Subject: unable to render initial data in ModelForm called through
> CreateView
>
> hello list
>
> i ran into some weird stuff and neither i nor 2 gentle folks down at the
> irc-chat could find any obvious problems. task
2018 2:48 PM
To: django-users@googlegroups.com
Subject: unable to render initial data in ModelForm called through CreateView
hello list
i ran into some weird stuff and neither i nor 2 gentle folks down at the
irc-chat could find any obvious problems. task should have been easy:
calculate some
hello list
i ran into some weird stuff and neither i nor 2 gentle folks down at the
irc-chat could find any obvious problems. task should have been easy:
calculate some special initial data and present it as initials in a
form. the form is showed correctly, and the right values are printed in
I'm not trying to be antagonistic, sorry if I came off that way. I wanted
to point out the difficulties that Django encountered trying to provide
"integration" tests like django-otp does. As others suggested, if
django-otp provided tools to build your own integration tests, that might
be a bett
On Wednesday 22 February 2017 15:13:47 'Tom Evans' via Django users wrote:
> These tests exercise parts of django_otp that interact with parts of
> my code. Successful tests indicate that those two parts interoperate
> correctly. The tests are successful when run individually, but fail
> when run
ions about loading data for apps. Doesn't
> > mention
> > anything in regards to tests. Why are fixtures bad for tests? In
> > fact, right
> > above the "Providing initial data with migrations" section is a
> > "See also"
> > box that say
e(s).
>
> I think you have misunderstood:
>
> 1) The test cases belong to a library and cannot be modified
So don't use them as is or prompt the authors to update to the new way of
things. In
transition, you can extend the test cases and simply add a fixture attribute.
> 2
On Wed, Feb 22, 2017 at 2:40 PM, Tim Graham wrote:
> I'm curious if you feel that running django_otp's tests as part of your
> project's tests is adding value.
I'm curious whether you think I commonly spend my time doing things
that I don't think add value...
django_otp is simply an example of t
In fact, right
> above the "Providing initial data with migrations" section is a "See also"
> box that says "Fixtures are also used by the testing framework to help set
> up a consistent test environment". It would seem to me that the docs are
> telling you to
case.
> >
> >>
> >
> >>
> >
> >> What is the "correct" way of ensuring that these instances exist in
> >
> >> the test database before any test is run?
> >
> >
> >
> > All explained in the docs.
is the "correct" way of ensuring that these instances exist
> > > in
> > >
> > > the test database before any test is run?
> >
> >
> > All explained in the docs.
> >
> > Either redeclare the same fixtures for different test case
lare the same fixtures for different test cases or reorganize
> your testcases to share the same fixture(s).
>
I think you have misunderstood:
1) The test cases belong to a library and cannot be modified
2) The initial data is populated from a data migration and not from a
fixture, as that
On Tuesday 21 February 2017 19:00:42 'Tom Evans' via Django users wrote:
> Previously, these instances were loaded from a JSON fixtures file,
And you can still do that.
> which used to be the recommended way. For our own tests, we simply
> load these fixtures in the setUp portion of the test; ob
Hi all
I'm having some difficulty working out how I am supposed to provide
initial data for testing purposes, particularly when the initial data
is not immediately pertinent to the test.
For instance, our project uses django_otp, which has some simple
tests. However, these tests create
e latest release (well, we're at 1.7
> now, but that's the end goal anyway) and replacing South migrations
> with Django migrations.
>
> It looks like that fixtures are no longer thought of as the correct
> way of providing initial data. Is this because Run{SQL,Python} can
&
Hi all
We're moving a project over to the latest release (well, we're at 1.7
now, but that's the end goal anyway) and replacing South migrations
with Django migrations.
It looks like that fixtures are no longer thought of as the correct
way of providing initial data. Is this
Ok..thanks..it worked...Created a script to create the fixture file and
update it with every record...what a community this is!
On Sunday, March 20, 2016 at 12:50:30 PM UTC-7, ludovic coues wrote:
>
> First, you should create a fixture file with some sample data. Two
> entry, just like in the do
First, you should create a fixture file with some sample data. Two
entry, just like in the documentation is good. This way, you know you
have a working fixture file.
Then, you write a python function which take a list of bet and output
a fixture file just like the exemple you have done.
Finally,
Thanks ludovic, here is my code for the scraper..
from .models import Betting
import re
import requests
import urllib
from bs4 import BeautifulSoup
urls= "https://sms.betyetu.co.ke/tomorrow.html";
htmlfile = urllib.urlopen(urls)
htmltext = htmlfile.read()
soup = BeautifulSoup(htmltext, "h
There is a page in the documentation dealing with initial data [1].
The good news is that you don't have to write more code. You insert
your data in a file and load it with the manage.py command. Out of the
box, JSON, XML and SQL are supported.
[1] https://docs.djangoproject.com/en/1.9/
Hi All,
I have built a web scraper to scrape a website and get all match fixtures
for a particular day. Wanted to know how to insert that initial data into
django database and where that code should live..I have currently put the
code in init.py but it looks and sounds wrong according to a
m reported in
> https://code.djangoproject.com/ticket/25251#comment:3
>
>
> On Thursday, February 11, 2016 at 1:16:20 PM UTC-5, Carlos Leite wrote:
>>
>> Hi there,
>>
>> I'm running a Django==1.8 app
>> I read in the docs [1], to consider doing a
a data migration to load initial
> data on db, since initial fixture is consider deprecated since 1.7.
>
> Well, to keep my app up-to-date I choose to load "initial data" trough a
> data migration.
>
> My problem, SEEMS to be when I run tests using the "--keep
Hi there,
I'm running a Django==1.8 app
I read in the docs [1], to consider doing a data migration to load initial
data on db, since initial fixture is consider deprecated since 1.7.
Well, to keep my app up-to-date I choose to load "initial data" trough a
data migration.
My pr
Hi there,
as pointed in documentation [1], automatic loading of initial data from
initial_data.[xml/yaml/json] is deprecated since 1.7 in favor of data
migrations.
However, there are several drawbacks and differencies:
1. Data migration is executed only once (unless migrations are
I have been digging around for about 24 hours now and am still not able to
solve this. I am using a 'haystack.forms.FacetedSearchForm' and want set
some initial field values to some of the form fields.
Here are some more details on what I am trying to do.
http://stackoverflow.com/questions/1634
#x27;ve spend several hours trying to figure out how to save inlines with
>>> initial data in them.
>>>
>>> basically I have a very simple model with 2 fields:
>>>
>>> class DirectIface(models.Model):
>>> parent = models.ForeignKey('nodes
On Tue, Mar 5, 2013 at 3:11 AM, Russell Keith-Magee wrote:
>
>
> On Mon, Mar 4, 2013 at 10:31 PM, Marc Aymerich wrote:
>
>> Hi,
>> I've spend several hours trying to figure out how to save inlines with
>> initial data in them.
>>
>> basically I have
On Tue, Mar 5, 2013 at 3:11 AM, Russell Keith-Magee wrote:
>
>
> On Mon, Mar 4, 2013 at 10:31 PM, Marc Aymerich wrote:
>
>> Hi,
>> I've spend several hours trying to figure out how to save inlines with
>> initial data in them.
>>
>> basically I have
On Mon, Mar 4, 2013 at 10:31 PM, Marc Aymerich wrote:
> Hi,
> I've spend several hours trying to figure out how to save inlines with
> initial data in them.
>
> basically I have a very simple model with 2 fields:
>
> class DirectIface(models.Model):
> parent =
Hi,
I've spend several hours trying to figure out how to save inlines with
initial data in them.
basically I have a very simple model with 2 fields:
class DirectIface(models.Model):
parent = models.ForeignKey('nodes.Node')
name = models.CharField(max_lenght=64)
And wh
On Fri, 23 Dec 2011 09:42:37 +0100, Mengu wrote:
you need to set "initial" attribute of TypedChoiceField.
Thanks, I knew about the initial only on form instance and not on field :)
On Dec 23, 10:34 am, Martin Tiršel wrote:
Hello,
I have:
class SomeForm(forms.Form):
...
def __
you need to set "initial" attribute of TypedChoiceField.
On Dec 23, 10:34 am, Martin Tiršel wrote:
> Hello,
>
> I have:
>
> class SomeForm(forms.Form):
> ...
>
> def __init__(self, *args, **kwargs):
> ...
> super(SomeForm, self).__init__(*args, **kwargs)
> ...
Hello,
I have:
class SomeForm(forms.Form):
...
def __init__(self, *args, **kwargs):
...
super(SomeForm, self).__init__(*args, **kwargs)
...
self.fields['starting_location'] = forms.TypedChoiceField(
label=_('Starting location'),
ch
Have you called form.is_valid() somewhere that you're not showing?
On Wed, Nov 9, 2011 at 7:15 AM, Asif Jamadar wrote:
> I’m assigning initial data to the field of each formset dynamically. But
> when I’m trying to save that initial data it’s throwing “Key Error” in
> cleaned data
I'm assigning initial data to the field of each formset dynamically. But when
I'm trying to save that initial data it's throwing "Key Error" in cleaned data.
Any solution?
Here is the code:
In views.py
for form in formset.forms:
qu
this initial can be a queryset or a list, but the list must use its
primary key like sform = SymptomeForm(initial={'parent':[1,2]})
On 9月7日, 上午4时30分, Thomas49 wrote:
> Hello,
>
> I have two models, and the second contains a ManyToMany relationship:
>
> class TypeMedical(models.Model):
>...
>
> Look into formsets. It's what the admin inlines use.
that is
class TypeMedicalForm(forms.ModelForm):
class Meta:
model = TypeMedical
TypeMedicalFormSet=formset_factory(TypeMedicalForm)
take a look at the django docs for more details
--
"The whole of Japan is pure invention. There is no
Look into formsets. It's what the admin inlines use.
On Tue, Sep 6, 2011 at 5:40 PM, Nan wrote:
>
> Because SymptomeForm is a ModelForm, it will initialize its "parent"
> field as a ModelMultipleChoiceField, which I believe must be
> initialized with a queryset instead of a list.
>
> On Sep 6, 4
Because SymptomeForm is a ModelForm, it will initialize its "parent"
field as a ModelMultipleChoiceField, which I believe must be
initialized with a queryset instead of a list.
On Sep 6, 4:30 pm, Thomas49 wrote:
> Hello,
>
> I have two models, and the second contains a ManyToMany relationship:
>
Hello,
I have two models, and the second contains a ManyToMany relationship:
class TypeMedical(models.Model):
...
class Symptome(TypeMedical):
...
parent =
models.ManyToManyField(TypeMedical,related_name='Parent',blank=True)
...
Then, I use a ModelForm in order to save data.
cla
Thanks for your reply, Daniel.
I read the docs, but did not understand them properly. Your
explanation makes sense, but doesn't seem to be working for me, for
some reason. I followed the docs from
https://docs.djangoproject.com/en/1.3/topics/forms/modelforms/#inline-formsets
precisely, but am ge
On Tuesday, 31 May 2011 15:20:11 UTC+1, snfctech wrote:
>
> Thanks, Jayapal.
>
> I was hoping there was a little less java/ more django way to do this
> by utilizing a Django ModelForm or InlindeFormSet and rendering
> partial views.
>
> So am I missing the point of InlineFormSets? Can these n
On Tue, May 31, 2011 at 9:20 AM, snfctech wrote:
> I was hoping there was a little less java/ more django way to do this
i haven't seen any Java around Dojo toolkit
--
Javier
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this
Thanks, Jayapal.
I was hoping there was a little less java/ more django way to do this
by utilizing a Django ModelForm or InlindeFormSet and rendering
partial views.
So am I missing the point of InlineFormSets? Can these not be
populated with data so they can be used to edit a set of existing
re
lay a list of records that have some editable fields and
> some readonly fields, as well as asynchronously add new records to the
> list. I thought the way to start would be with an InlineFormSet - but
> I can't figure out how to populate my formset with initial data. E.g.
> MyIn
I want to display a list of records that have some editable fields and
some readonly fields, as well as asynchronously add new records to the
list. I thought the way to start would be with an InlineFormSet - but
I can't figure out how to populate my formset with initial data.
On May 9, 12:24 pm, Karen Tracey wrote:
> On Mon, May 9, 2011 at 12:56 AM, Adam Seering wrote:
> > On May 8, 10:53 pm, Karen Tracey wrote:>
> > > The change you have noticed is documented in the 1.3
> > > backwards-incompatibility list:
> >http://docs.djangoproject.com/en/1.3/releases/1.3/#use
On Mon, May 9, 2011 at 12:56 AM, Adam Seering wrote:
> On May 8, 10:53 pm, Karen Tracey wrote:>
> > The change you have noticed is documented in the 1.3
> > backwards-incompatibility list:
> http://docs.djangoproject.com/en/1.3/releases/1.3/#use-of-custom-sql-...
>
> Actually, that's a different
On May 8, 10:53 pm, Karen Tracey wrote:
> On Sun, May 8, 2011 at 10:13 PM, Adam Seering wrote:
> > (Incidentally, sorry if this is a duplicate; my original reply,
> > identical text, doesn't show up on groups.google.com...)
>
> I don't know why, but google groups decided your original message m
cumented in the 1.3
backwards-incompatibility list:
http://docs.djangoproject.com/en/1.3/releases/1.3/#use-of-custom-sql-to-load-initial-data-in-tests
Of the alternatives you list, using setUp seems like the correct approach.
I'm a little confused by your worry both that you're inevitably
On May 8, 7:16 pm, Jacob Kaplan-Moss wrote:
> On Sun, May 8, 2011 at 4:25 PM, Adam Seering wrote:
> > I have some Python code that generatesinitialdatafor some of my tables; I
> > currently call that code from a post_syncdb hook. In Django 1.3, it looks
> > like
> > Django now calls TRUNCATE (
On Sun, May 8, 2011 at 4:25 PM, Adam Seering wrote:
> I have some Python code that generates initial data for some of my tables; I
> currently call that code from a post_syncdb hook. In Django 1.3, it looks like
> Django now calls TRUNCATE (or an equivalent non-PostgreSQL-ism) on a
Hi,
I have some Python code that generates initial data for some of my
tables; I currently call that code from a post_syncdb hook. In Django 1.3, it
looks like Django now calls TRUNCATE (or an equivalent non-PostgreSQL-ism) on
all tables after running syncdb and all of its post- hooks
Hmm, I see your commit; Did you get a confirmation message from your
database that the commit worked?
Perhaps you could try inserting the data via a python script.
import sqlite3
# create/connect to a permanent file database
con = sqlite3.connect("pyfitness2.db")
# establish the cursor, needed to
Forgive if this is totally obvious, but I'm having a bit of trouble
getting data into my first prototype with django.
I am prototyping an application called repository, syncdb builds my
tables and all seems to work in the admin interface.
However, I have 600 lines of data I want to use as the see
Forgive if this is totally obvious, but I'm having a bit of trouble
getting data into my first prototype with django.
I have put together an application with three tables defined in
models.py. syncdb builds them and all seems to work in the admin
interface.
I w
--
You received this message bec
Sorry I'm tired. Got it !
collection = MediaCollection.objects.get(public_id=public_id)
form = MediaCollectionForm(instance=collection)
2011/2/18 YomGuy
> Hi !
>
> I need to get initial data in a form.
> Do I have to use a formset or is there any method to fill a form comi
Hi !
I need to get initial data in a form.
Do I have to use a formset or is there any method to fill a form coming from
a model item with existing data ?
Thank for help
G
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to
This don't work to me. Now I must to use the "." like a thousand
separator and the "," like decimal separator (x.xxx,xx) (requirement
of the boss). I try to follow the guide to "custom format fields" in
the Django documentation, but I can't get formatted numbers.
I have this:
-
Thanks, you are the best
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more optio
I don't think you need to change the value, but rather add
localization so add proper formatting.
http://docs.djangoproject.com/en/dev/topics/i18n/localization/#format-localization
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this
Hello list. I have a model "PP" with a "float" field "val" and a
modelform for this model
For update the data of a existent "PP" I use a form like this
Form_for_PP(request,POST, instance=instance)
Now my question is, Can I change the initial data for
x27;:'Online','status':'Enabled'}),
> }
> )
> when runing,i got following errors:
> __init__() got an unexpected keyword argument 'initial'
> so,how to initial data for inlineformset?thanks.
>
> --
> You recei
:documentForm(initial={'tSUser':getEDSByUObj(request.user,
[]),'documentType':'Online','status':'Enabled'}),
}
)
when runing,i got following errors:
__init__() got an unexpected keyword argument 'initial'
so,how to initial d
Hi all,
I want to provide automatically loaded initial data for the third
party app - 'django-tagging'. There is a special place for internal
apps: /fixtures/initial_data.yaml, but not for a third
party.
I want data to bi initialized on ./manage.py syncdb
There are many similar quest
I wasn't using ProfileForm(instance = userProfile) because I didn't
realize I could. Wow, that makes things easier and neater.
Thanks so much.
On Mar 25, 11:57 am, Nuno Maltez wrote:
> >On Thu, Mar 25, 2010 at 2:00 AM, mjlissner wrote:
> > I'll make things more concrete. I have the following in
>On Thu, Mar 25, 2010 at 2:00 AM, mjlissner wrote:
> I'll make things more concrete. I have the following in my model
> (which is made into a ModelForm):
> class UserProfile(models.Model):
> barmembership = models.ManyToManyField(BarMembership,
> verbose_name="the bar memberships held by
submit the form just fine, but it NEVER
prepopulates with initial data.
I'll make things more concrete. I have the following in my model
(which is made into a ModelForm):
class UserProfile(models.Model):
barmembership = models.ManyToManyField(BarMembership,
verbose_name="the
Ah. That does make sense! I cant believe I missed that in the docs.
Thanks for pointing it out!
On Mar 5, 7:08 am, David De La Harpe Golden
wrote:
> On 05/03/10 01:30, NaMaK wrote:
>
> class DateTest(forms.Form):
> > ... in_date=forms.DateTimeField(initial=datetime.datetime.now())
> > .
On 05/03/10 01:30, NaMaK wrote:
class DateTest(forms.Form):
... in_date=forms.DateTimeField(initial=datetime.datetime.now())
...
Well, note that the now() was executed when python first saw it, which
was just a bit after it first saw the class definition. Think about it -
it does make se
Hi,
I am using Django 1.1. When I create a form, the initial data is set
when the class is created. It does not get updated when an object is
created. The following can demonstrate:
>>>
>>> import datetime
>>> from django import forms
>>>
>>> datetim
the general
method I can apply it to all my database tables.
Hope this helps someone.
-Tim
On Fri, Feb 19, 2010 at 1:09 PM, Timothy Kinney wrote:
> I started playing with this last night and got about as far as you
> mentioned here. What I want to be able to do, though, is write a python
n Fri, Feb 19, 2010 at 11:13 AM, Rick Caudill wrote:
> Hi all,
>
> I just came across a need to provide initial data for flatpages. I have
> read before that people have asked to do this. It is easier than thought
> :)
>
> 1. Create your content via the admin interface
&
Hi all,
I just came across a need to provide initial data for flatpages. I have
read before that people have asked to do this. It is easier than thought
:)
1. Create your content via the admin interface
2. Run 'python manage.py dumpdata flatpages > data.json'
3. When you want t
Jacob,
Thanks so much for this; it really helped me.
Tom
On Feb 16, 8:29 pm, Jacob Kaplan-Moss wrote:
> On Tue, Feb 16, 2010 at 10:01 AM, Tom wrote:
> > I can set other initial data, for example to the 'notes' CharField
> > fine. I guess my question boils down to: ho
On Tue, Feb 16, 2010 at 10:01 AM, Tom wrote:
> I can set other initial data, for example to the 'notes' CharField
> fine. I guess my question boils down to: how do you set initial data
> for a many-to-many field?
The initial data for a many to many field needs to be
: contact.id})
return render_to_response('addcontactemail.html', {'formset': f})
But I am getting "Caught an exception while rendering: 'long' object
is not iterable" thrown when the browser tries to render the form in
the addcontactemail.html template.
I
On Feb 2, 1:45 pm, Russell Keith-Magee wrote:
> Correct. I'm guessing that the same thing is happening - the default
> value is being used because the fixture doesn't specify a value. Feel
> free to update the ticket so the auto_now case isn't forgotten.
Done ;)
Kind regards,
Andrew
--
You rec
On Tue, Feb 2, 2010 at 9:41 PM, Andrew Turner wrote:
> On Feb 2, 1:29 pm, Russell Keith-Magee wrote:
>> The cause of the problem is your initial fixture. Django doesn't
>> listen to auto_now_add or auto_now fields on fixture loading - fixture
>> objects are saved in "raw" mode, so it is assumed t
On Feb 2, 1:29 pm, Russell Keith-Magee wrote:
> The cause of the problem is your initial fixture. Django doesn't
> listen to auto_now_add or auto_now fields on fixture loading - fixture
> objects are saved in "raw" mode, so it is assumed that the fixture
> should have data for all the fields. In t
On Tue, Feb 2, 2010 at 5:12 PM, Andrew Turner wrote:
> On Feb 2, 8:07 am, Russell Keith-Magee wrote:
>> It is possible you've found a bug, but in order to verify that, we
>> need a minimal example that reproduces the problem - that is, the
>> simplest possible model and fixture combination that f
On Feb 2, 8:07 am, Russell Keith-Magee wrote:
> It is possible you've found a bug, but in order to verify that, we
> need a minimal example that reproduces the problem - that is, the
> simplest possible model and fixture combination that fails on the
> second syncdb like you describe.
Thanks for
On Tue, Feb 2, 2010 at 3:58 PM, Andrew Turner wrote:
> On Jan 19, 1:36 pm, Andrew Turner wrote:
>> I have an initial_data.json file which provides some, er, initial data
>> whenever I run syncdb. One of my models has a DateTimeField with
>> auto_now_add=True. The data is lo
On Jan 19, 1:36 pm, Andrew Turner wrote:
> I have an initial_data.json file which provides some, er, initial data
> whenever I run syncdb. One of my models has a DateTimeField with
> auto_now_add=True. The data is loaded first time round, but on
> subsequent syncdbs, I get &qu
heya,
This is a small question, is there any way for the initial_data.json/
xml/sql file to reference other files, or split it up across multiple
files?
Basically, I want to split up my existing monolithic files, into a
separate json file for each section (I'm basically using this to
populate all
I have an initial_data.json file which provides some, er, initial data
whenever I run syncdb. One of my models has a DateTimeField with
auto_now_add=True. The data is loaded first time round, but on
subsequent syncdbs, I get "IntegrityError: posts_entry.pub_date may
not be NULL".
I
I'm trying to use initial data with an inline_formset and I get this
>>> fs = SectionFormSet(initial=section_initial)
Traceback (most recent call last):
File "", line 1, in
TypeError: __init__() got an unexpected keyword argument 'initial'
>>>
But
_to_response('attend_to_company.html', {'form':
form}, context_instance=RequestContext(request))
When I access the view via HTTP GET, if I use form =
AttendToCompanyForm(data) then the state field (a drop down select) in
the form is populated correctly and the corresponding state
> for x in range(1, num_events):
> > initial_data_list.append(pattern_datetime_dict)
>
> > formset = DateTimeFormSet(initial = initial_data_list)
>
> Your initial data list only has (num_events - 1) elements. And
> formset_factory is returning a for
t,
> }
>
> for x in range(1, num_events):
> initial_data_list.append(pattern_datetime_dict)
>
> formset = DateTimeFormSet(initial = initial_data_list)
Your initial data list only has (num_events - 1) elements. And
formset_factory is returning a formset
This code creates a formset and populates fields with copies of
date and start_time.
The problem is, if num_events is X then it creates X forms but it only
populates X-1 (it leaves the last one uninitialized). My question
is why, and how to fix it? Thanks.
DateTimeFormSet = for
1 - 100 of 179 matches
Mail list logo