hi all, i don't understand why my **project-level** initial_data.json fixtures (which just create a user) won't load anymore since django 1.7: Problem installing fixture '/home/jpic/env/src/session-security/test_project/fixtures/initial_data.json': Could not load auth.User(pk=1): no such table: auth_user. Any idea please ?
viwal_
how can I write it then?
tbaxter
viwal_: I don’t understand your question
TripTastic joined the channel
Genitrust joined the channel
I just gave you a fully functional CreateView
viwal_
yes
sure
bibhas
tbaxter, In those cases, I just extend View, at least I dont have to keep checking request.method =='post'
viwal_
at this case
but if I need any functionality that is not in any cbv?
tbaxter
bibhas: if you’re checking post, shouldn’t you at least be using FormView :-)
and it's really really awesome what your ModelForm can do out of the box
ArcTanSusan_ joined the channel
jwhite007
is_null: http://pastebin.com/0A00VQth in my class Meta i render 'contacts'; however it's listing contacts for all of my users. how do i make the contacts user-specific?
aul has quit
bathtub95 joined the channel
grafa joined the channel
grafa has quit
kyrix has quit
grafa joined the channel
is_null
oh, i thought you were talking about metaclasses, well there are many ways really, for a contact select i'd use an autocomplete field
Loplin joined the channel
jwhite007
is_null: each user will have multiple contacts.
…to choose from.
FlyingMongoose has quit
Loplin
After restoring a database dump in mysql, I get "Field 'id' doesn't have a default value"" from User.objects.create_user
is_null
if your contact list is huge, a checkbox select or multiple select will be a bit unconvenient to use
jwhite007
is_null: can i handle that in the views function which renders the form?
unbracketed joined the channel
Loplin
Is there a good way to initialize those things when restoring?
ethos_w joined the channel
is_null
jwhite007: you could, but it would be better to encapsulate that constraint in the form class, and maybe even enforce it at the pre_save level
jwhite007
is_null: i know how to build the form, but i want the form to only show contacts for a particular user, not all the contacts in the db.
viwal_ has quit
is_null: does that make sense?
is_null
jwhite007: well you'll have to pass the user to the form or form field at some point
yeah it's pretty common
jwhite007
is_null: so… i'd pass the user to the form from the function in views.py… right?
is_null
that way works
kyrix joined the channel
then in the form you could use that user variable to update your form field's choices
jwhite007
is_null: how would i then use it in the class Meta?
jwhite007: there is no magic option to filter a ChoiceField.choices queryset based on a value **which you are providing manually**, in Meta, nor anywhere else, to my knowledge
jwhite007
is_null: i'm just building a form from the model with class Meta.
underthehill has quit
is_null: hmmm.
doismellburning
is it terrible of me to use django.contrib.staticfiles.storage.staticfiles_storage in my code?
or just make a new queryset, it doesn't make a difference
ethos_w has quit
afaik
jwhite007
is_null: cool… i'll try and refactor my code. thanks for the tips.
maryokhin has quit
SmileyChris
doismellburning: sounds fine to me
eVRiAL has quit
doismellburning
SmileyChris: I'm never 100% clear on "API vs internal" in a lot of cases
is_null
hi all, i don't understand why my **project-level** initial_data.json fixtures (which just create a user) won't load anymore since django 1.7: Problem installing fixture '/home/jpic/env/src/session-security/test_project/fixtures/initial_data.json': Could not load auth.User(pk=1): no such table: auth_user. Any idea please ?
doismellburning
SmileyChris: (obviously some things are clearly API)