Re: Initial data doesn't go complelely in the modelformset

2021-06-13 Thread VISHESH MANGLA
= 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 initi

Initial data doesn't go complelely in the modelformset

2021-06-13 Thread VISHESH MANGLA
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 formset and the

initial data inlineAdmin

2019-03-21 Thread carlos
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 =

RE: How to get multi form initial data?

2018-09-11 Thread Matthew Pava
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 = { 'contactInformation

How to get multi form initial data?

2018-09-11 Thread Django Lover
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 = { 'contactInformation

Re: unable to render initial data in ModelForm called through CreateView

2018-03-07 Thread furzihurzischleim
> 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 > *To:*

RE: unable to render initial data in ModelForm called through CreateView

2018-03-07 Thread Matthew Pava
: 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 from

RE: unable to render initial data in ModelForm called through CreateView

2018-03-07 Thread Matthew Pava
/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

Re: unable to render initial data in ModelForm called through CreateView

2018-03-07 Thread furzihurzischleim
ngo...@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:

RE: unable to render initial data in ModelForm called through CreateView

2018-03-06 Thread Matthew Pava
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 special initial

unable to render initial data in ModelForm called through CreateView

2018-03-05 Thread Gabriel Wicki
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

Re: Initial data, tests and migrations

2017-02-22 Thread Tim Graham
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

Re: Initial data, tests and migrations

2017-02-22 Thread Melvyn Sopacua
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

Re: Initial data, tests and migrations

2017-02-22 Thread Adam Stein
to mentions 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

Re: Initial data, tests and migrations

2017-02-22 Thread Melvyn Sopacua
ame fixture(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

Re: Initial data, tests and migrations

2017-02-22 Thread 'Tom Evans' via Django users
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

Re: Initial data, tests and migrations

2017-02-22 Thread 'Tom Evans' via Django users
for tests? 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 > telli

Re: Initial data, tests and migrations

2017-02-22 Thread Tim Graham
t; >> > > > >> > > > >> 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. > >

Re: Initial data, tests and migrations

2017-02-22 Thread Adam Stein
t; 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 cases or > > reorganize

Re: Initial data, tests and migrations

2017-02-22 Thread 'Tom Evans' via Django users
t; Either redeclare 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

Re: Initial data, tests and migrations

2017-02-21 Thread Melvyn Sopacua
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;

Initial data, tests and migrations

2017-02-21 Thread 'Tom Evans' via Django users
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 user

Re: Initial data with migrations vs fixtures

2016-12-01 Thread Tim Graham
elease (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 > have &

Initial data with migrations vs fixtures

2016-12-01 Thread 'Tom Evans' via Django users
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 because Run{SQL

Re: Entering initial data into django database

2016-03-20 Thread Lawrence Muriuki
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

Re: Entering initial data into django database

2016-03-20 Thread ludovic coues
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,

Re: Entering initial data into django database

2016-03-20 Thread Lawrence Muriuki
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,

Re: Entering initial data into django database

2016-03-20 Thread ludovic coues
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/howto

Entering initial data into django database

2016-03-20 Thread Lawrence Muriuki
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

Re: manage.py --keepdb VS DataMigration as Initial Data

2016-02-11 Thread Carlos Leite
e running into the same problem 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 d

Re: manage.py --keepdb VS DataMigration as Initial Data

2016-02-11 Thread Tim Graham
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 "--keepdb&qu

manage.py --keepdb VS DataMigration as Initial Data

2016-02-11 Thread Carlos Leite
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 prob

Initial data in 1.7

2014-07-21 Thread Tomas Ehrlich
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

set initial data to django-haystacks FacetedSearchForm

2013-05-03 Thread Amyth Arora
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.

Re: Django inline formsets, force initial data to be saved.

2013-03-05 Thread Marc Aymerich
m>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): &g

Re: Django inline formsets, force initial data to be saved.

2013-03-05 Thread Marc Aymerich
On Tue, Mar 5, 2013 at 3:11 AM, Russell Keith-Magee <russ...@keith-magee.com > wrote: > > > On Mon, Mar 4, 2013 at 10:31 PM, Marc Aymerich <glicer...@gmail.com>wrote: > >> Hi, >> I've spend several hours trying to figure out how to save inlines with >> in

Re: Django inline formsets, force initial data to be saved.

2013-03-05 Thread Marc Aymerich
On Tue, Mar 5, 2013 at 3:11 AM, Russell Keith-Magee <russ...@keith-magee.com > wrote: > > > On Mon, Mar 4, 2013 at 10:31 PM, Marc Aymerich <glicer...@gmail.com>wrote: > >> Hi, >> I've spend several hours trying to figure out how to save inlines with >> in

Django inline formsets, force initial data to be saved.

2013-03-04 Thread Marc Aymerich
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 what I'm doing

Re: Initial data for dynamic field

2011-12-23 Thread Martin Tiršel
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

Re: Initial data for dynamic field

2011-12-23 Thread Mengu
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,

Initial data for dynamic field

2011-12-23 Thread Martin Tiršel
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'),

Re: initial data to Formset causing problem

2011-11-10 Thread Bill Freeman
Have you called form.is_valid() somewhere that you're not showing? On Wed, Nov 9, 2011 at 7:15 AM, Asif Jamadar <asif.jama...@rezayat.net> 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 throwin

initial data to Formset causing problem

2011-11-09 Thread Asif Jamadar
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: question = form.s

Re: Initial data for ManyToMany field

2011-09-16 Thread Danfi
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

Re: Initial data for ManyToMany field

2011-09-06 Thread Tomas Neme
> 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

Re: Initial data for ManyToMany field

2011-09-06 Thread Tomas Neme
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

Re: Initial data for ManyToMany field

2011-09-06 Thread Nan
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

Initial data for ManyToMany field

2011-09-06 Thread Thomas49
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.

Re: how to implement a data grid? (or populate inlineformset with initial data)

2011-05-31 Thread snfctech
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

Re: how to implement a data grid? (or populate inlineformset with initial data)

2011-05-31 Thread Daniel Roseman
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

Re: how to implement a data grid? (or populate inlineformset with initial data)

2011-05-31 Thread Javier Guerra Giraldez
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

Re: how to implement a data grid? (or populate inlineformset with initial data)

2011-05-31 Thread snfctech
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: how to implement a data grid? (or populate inlineformset with initial data)

2011-05-31 Thread jai_python
com> wrote: > 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

how to implement a data grid? (or populate inlineformset with initial data)

2011-05-30 Thread snfctech
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. E.g

Re: Loading initial data with a post_syncdb hook?

2011-05-09 Thread Adam Seering
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

Re: Loading initial data with a post_syncdb hook?

2011-05-09 Thread Karen Tracey
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: >

Re: Loading initial data with a post_syncdb hook?

2011-05-08 Thread Adam Seering
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

Re: Loading initial data with a post_syncdb hook?

2011-05-08 Thread Karen Tracey
d is documented 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 going t

Re: Loading initial data with a post_syncdb hook?

2011-05-08 Thread Adam Seering
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

Re: Loading initial data with a post_syncdb hook?

2011-05-08 Thread Jacob Kaplan-Moss
On Sun, May 8, 2011 at 4:25 PM, Adam Seering <aseer...@gmail.com> 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

Loading initial data with a post_syncdb hook?

2011-05-08 Thread Adam Seering
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

Re: Initial Data SQL not sticking?

2011-03-27 Thread fdo
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

Initial Data SQL not sticking?

2011-03-26 Thread Daniel Pugh
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

Initial Data SQL not sticking?

2011-03-26 Thread Daniel Pugh
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

Re: Initial data in forms

2011-02-17 Thread YomGuy
Sorry I'm tired. Got it ! collection = MediaCollection.objects.get(public_id=public_id) form = MediaCollectionForm(instance=collection) 2011/2/18 YomGuy <yomguyparis...@gmail.com> > Hi ! > > I need to get initial data in a form. > Do I have to use a formset or is there any met

Initial data in forms

2011-02-17 Thread 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 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

Re: Change the initial data to a modelForm

2010-11-02 Thread refreegrata
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:

Re: Change the initial data to a modelForm

2010-11-02 Thread refreegrata
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

Re: Change the initial data to a modelForm

2010-11-02 Thread Shawn Milochik
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

Change the initial data to a modelForm

2010-11-02 Thread refreegrata
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

Re: how to initial data for inlineformset

2010-05-06 Thread victor
      } >         ) > when runing,i got following errors: > __init__() got an unexpected keyword argument 'initial' > so,how to initial data for inlineformset?thanks. > > -- > You received this message because you are subscribed to the Google Groups > "D

how to initial data for inlineformset

2010-05-06 Thread victor
':getEDSByUObj(request.user, []),'documentType':'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 received this message because you are subscribed

[django] automatically loading initial data fixtures for third party apps

2010-04-10 Thread Andreo
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 questions: http

Re: Initial data in a many to many field

2010-03-25 Thread mjlissner
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

Re: Initial data in a many to many field

2010-03-25 Thread Nuno Maltez
>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

Initial data in a many to many field

2010-03-24 Thread mjlissner
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 bar memberships

Re: Form initial data is not dynamic

2010-03-05 Thread NaMaK
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): > > ...    

Re: Form initial data is not dynamic

2010-03-05 Thread David De La Harpe Golden
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

Form initial data is not dynamic

2010-03-04 Thread NaMaK
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

Re: Providing flatpages initial data

2010-02-19 Thread Timothy Kinney
Hope this helps someone. -Tim On Fri, Feb 19, 2010 at 1:09 PM, Timothy Kinney <timothyjkin...@gmail.com>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 > script that writes an

Re: Providing flatpages initial data

2010-02-19 Thread Timothy Kinney
, Feb 19, 2010 at 11:13 AM, Rick Caudill <cau0...@gmail.com> 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 t

Providing flatpages initial data

2010-02-19 Thread Rick Caudill
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 to prov

Re: Setting initial data for an M2M field

2010-02-16 Thread Tom
Jacob, Thanks so much for this; it really helped me. Tom On Feb 16, 8:29 pm, Jacob Kaplan-Moss <ja...@jacobian.org> wrote: > On Tue, Feb 16, 2010 at 10:01 AM, Tom <t.scr...@gmail.com> wrote: > > I can set other initial data, for example to the 'notes' CharField > >

Re: Setting initial data for an M2M field

2010-02-16 Thread Jacob Kaplan-Moss
On Tue, Feb 16, 2010 at 10:01 AM, Tom <t.scr...@gmail.com> 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 nee

Setting initial data for an M2M field

2010-02-16 Thread Tom
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 can set other initial data, for example to the 'notes' Char

Re: Initial data fixtures and auto_now_add=True

2010-02-02 Thread Andrew Turner
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

Re: Initial data fixtures and auto_now_add=True

2010-02-02 Thread Russell Keith-Magee
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 >>

Re: Initial data fixtures and auto_now_add=True

2010-02-02 Thread Russell Keith-Magee
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 >>

Re: Initial data fixtures and auto_now_add=True

2010-02-02 Thread Andrew Turner
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

Re: Initial data fixtures and auto_now_add=True

2010-02-02 Thread Russell Keith-Magee
On Tue, Feb 2, 2010 at 3:58 PM, Andrew Turner <acturne...@gmail.com> wrote: > On Jan 19, 1:36 pm, Andrew Turner <acturne...@gmail.com> wrote: >> I have an initial_data.json file which provides some, er, initial data >> whenever I run syncdb. One of my

Re: Initial data fixtures and auto_now_add=True

2010-02-01 Thread Andrew Turner
On Jan 19, 1:36 pm, Andrew Turner <acturne...@gmail.com> 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 > subsequ

Fixtures Initial Data - Split Into Multiple Files?

2010-01-20 Thread Victor Hooi
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

Initial data fixtures and auto_now_add=True

2010-01-19 Thread Andrew Turner
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

Initial data for inline_formset

2009-12-24 Thread Dave
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 inline formsets

Different behavior of form = SomeForm(data) and form = SomeForm(initial=data)

2009-06-20 Thread chefsmart
) then the state field (a drop down select) in the form is populated correctly and the corresponding state for the company appears as selected in the list, but when I use form = AttendToCompanyForm(initial=data) then the state field does not reflect the corresponding state for the company, and instead

Re: initial data for formset

2009-05-27 Thread adrian
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 forms

Re: initial data for formset

2009-05-26 Thread Sam Chuparkoff
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 class that generate

initial data for formset

2009-05-26 Thread adrian
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 =

Inline admin forms with dynamically defined initial data

2009-05-16 Thread foxbunny
Hi, all I have three models in many-to-many-through arrangement. Let's call them A, B, C, where B is the join model. I would like to edit B as inline from C, so that the number of inlines and their pre-filled data (if possible at all) matches the number of A objects. If I have, say three

Re: foreignkey values in formset initial data

2009-05-06 Thread bobhaugen
Responding to myself: If I specify the object.id instead of just a reference to the object as the initial field value, the selections work correctly. E.g. 'product': item.product.id instead of 'product': item.product --~--~-~--~~~---~--~~ You received

  1   2   >