Collecting additional information in the Django administration page?
on save if user select certain option i want to take user to a page where he can have one more field to be filled and then redirect to admin default page ...
on save if user select certain option i want to take user to a page where he can have one more field to be filled and then redirect to admin default page ...
I am having 2 models.i want to have model2 inline with model1 .On the admin page I want to show some fields of model 2 as a inlines and all of them as readonly.ALso when i click on the value of the inline i should link me to the model2 with that value A inline that show fields readonly .I want to show inline model fields as readonly ...
I am having a status Field which has 3 options 1)activated 2)rejected 3)pending.If user select rejected status then he has to enter reason for rejection else that reason field should be hidden.Or when user choices rejected i should redirect it to some other form so that i can send email using the rejection reason ...
I have a form. Once the form is filled I don't want the user to change anything in the form. But the user can see the values. Meaning all the fields are non editable. I can do this by using instance method but this does not help in foreignkey. ...
A have 3 models: Project, Image and Video with ManyToManyField relation: class Project(models.Model): images = models.ManyToManyField('Image', through='Project_Images') video = models.ManyToManyField('Video', through='Project_Video') class Image(models.Model): original = models.ImageField() projects = models.ManyToManyF...
I have made a inline named as Fooinline. This inline was working fine in Django 1.02 but as soon as I upgraded to Django 1.1 it started giving an error: **TypeError at /admin/casd/aaas/4028cb901dd9720a011deadd85e8007f/ __init__() got an unexpected keyword argument 'request'** My Fooinline code is: class FooInline(InlineModelAdmin): ...
I'm using Django forms in my website and would like to control the order of the fields. Here's how I define my forms: class edit_form(forms.Form): summary = forms.CharField() description = forms.CharField(widget=forms.TextArea) class create_form(edit_form): name = forms.CharField() The name is immutable and should only ...
Hi Guys, I have a list of products that I want to render inside a form in a template using a for loop. My problem is that when i do the template loop, I cant get access to the product attributes the form element is relating to: {% for field in form %} {{ field }} {% endfor %} I would like to be able to render the individual produc...
In my Django application application I have a formset that is created from a simple (not-model) form, with the extra=1 (to allow javasript to add more forms later on). class SomeForm(forms.Form): #some fields with required=False length = forms.IntegerField(required=False) # An example of one of the fields with choices i hav...
Hi everyone I have a few questions about the django admin. First the relevant details. I currently have Client, Printer, Cartridge, and Order models. The Printer model has a ManyToManyField to the Cartridge model, which would allow you to select all the cartridges that can be used with that printer. The Cliente has a ManyToManyField t...
I'm trying to prepopulate the data in my django form based on some information, but NOT using ModelForm, so I can't just set the instance. This seems like it should be really easy, but for some reason I can't find any documentation telling me how to do this. This is my form: class MyForm(forms.Form): charfield1 = forms.CharField(max...
I want to store the name of the user who is currently logged into Django in a custom form. In the admin we can do so by writing modified_by=request.user.username, but how do I do this in my own form? ...
I have strange problem with admin generic inline forms. I have two models, main Project and Video with ManyToMany relation trough VideoLink, becouse I need to be able linking different number of Video to Project and many project to Video: class VideoLink(models.Model): content_type = models.ForeignKey(ContentType) object_id = mo...
I keep field imdb_id for models Movie in my db: class Movie(models.Model): imdb_id = models.IntegerField('imdb ID', blank=True, null=True, unique=True) def _get_imdb_url(self): return self.imdb_id and 'http://www.imdb.com/title/tt%s/' % str(self.imdb_id).zfill(7) or '' def _set_imdb_url(self, imdb_url): sel...
I realize this has been asked before, but I wasn't able to find a question that really dealt with what I'm trying to do. I think it's pretty simple, but I'd like to know what the general population thinks is best form here. Lets say we have the following: models.py class TestClass(models.Model): user = models.ForeignKey(User) ...
Is there a straightforward way to access a POST variable to complete some custom validation lookups in a admin form field's clean method? def clean_order_price(self): if not self.cleaned_data['order_price']: try: existing_price = ProductCostPrice.objects.get(supplier=supplier, product_id=self.cleaned_data['product'], is_late...
Alright, I'm having a hard time explaining this, let me know if I should fill you in on more details. My url looks like this: http://domain.com/<category>/ Each <category> may have one or many sub categories. I want the category page to have a form with a select box (among other fields) containing the category sub-categories. I'...
I'm attempting a few simple calculations in a def clean method following validation (basically spitting out a euro conversion of retrieved uk product price on the fly). I keep getting a TypeError. Full error reads: Cannot convert {'product': , 'invoice': , 'order_discount': Decimal("0.00"), 'order_price': {...}, 'order_adjust': None, ...
I'm wanting to add a label= attribute to an option element of a Select form input using the Django Forms API without overwriting the Select widget's render_options method. Is this possible, if so, how? Note: I'm wanting to add a label directly to the option (this is valid in the XHTML Strict standard) not an optgroup. ...
I have a model, OrderedList, which is intended to be a listing of content objects ordered by the user. The OrderedList has several attributes, including a site which it belongs to. The content objects are attached to it via an OrderedListRow class, which is brought into OrderedList's admin via an inline formset in the admin. class Orde...