Given a Django.db models class:
class P(models.Model):
type = models.ForeignKey(Type) # Type is another models.Model class
name = models.CharField()
where one wishes to create a new P with a specified type, i.e. how does one make "type" to be a default, hidden field (from the user), where type is given likeso:
http://x.y/P/new?type=3
So that in the form no "type" field will appear, but when the P is saved, its type will have id 3 (i.e. Type.objects.get(pk=3)).
Secondarily, how does one (& is it possible) specify a "default" type in the url, via urls.py, when using generic Django views, viz.
urlpatterns = ('django.generic.views.create_update',
url(r'^/new$', 'create_object', { 'model': P }, name='new_P'),
)
I found that terribly difficult to describe, which may be part of the problem. :) Input is much appreciated!