You are trying to add a non-nullable field 'brand' to product without a default; we can't do that (the database needs something to populate existing rows).
do i have to manually edit each row with the missing column/field?
or is there a way to avoid that, by simply adding a Null value, or something like that.
darkryder
In the field `brand` that you've added in models.py. Either make it null=True, or add a default=<some_default_value>. Whatever logic suits your application
Paradisee
brand = models.ForeignKey(Brand)
mattmcc
Paradisee: And then it says "Please select a fix"
Paradisee
this is the field.
ya mattmcc, but i need to understand what to place inside that field.
mattmcc
How would you determine the brand that all existing rows should have?
Paradisee
what does that mean
slav0nic joined the channel
citizen-stig has quit
mattmcc
The field isn't nullable, so it has to have a value for each currently existing row.
Paradisee
by adding null=True, should work, if i let do that to django itself.
is there a way to make a specific field not required?
mattmcc
That's what null=True means. Although you'll also want blank=True for model validation purposes.
TrioTorus has quit
jaywink joined the channel
ticketbot has quit
vedrank joined the channel
ticketbot joined the channel
Paradisee
This field is required.
with null=True.
busla joined the channel
mattmcc
As I was saying, you'll also want blank=True for model validation purposes.
ehmatthes has quit
MarkusH
FunkyBob: How do I make a ModelDataMapper include a field on serialization but ignore it when a user uses the mapper to create a new object. I.e. Include the primary key but don't allow the user to set it during creation.
I can't find any docs on that
FunkyBob
MarkusH: define a @field for it, without a write option?
without a setter, that is
pytony joined the channel
by default setter does nothing
enkrypt has quit
gerbyzation joined the channel
MarkusH
FunkyBob: alright, and where do I e.g. set the creator for an object based on request.user?
FunkyBob
mmm?
jtiai_ joined the channel
not sure I understand
MarkusH
the complement to "form.instance.owner = self.request.user" in "form_valid()" on a CreateView
FunkyBob
well, since the datamapper doesn't save...
pwnz0r joined the channel
you cal _apply or _patch then do what you like
MarkusH
ah, ok
FunkyBob
in the CBV it'd be in post_valid or put_valit or...