Multiple django inlineformset_factory problem

2014-10-09 Thread Farhan Khan
Hi all, I am writing a tool that implements NIST security controls and having trouble implementing inlineformset_factory, which I think is the solution to this problem. Background: I have two models, one is called 'Controls' and the other is 'Implementation'. When the user goes to a page, the

Integer Form with Select Widget?

2014-10-25 Thread Farhan Khan
Hi all, I want to get an Integer value from the user through a forms.Form. I have three unique requirements for it. 1. The corresponding Widget is Select or SelectMultiple (either one) 2. The 'choices' field is dynamic, not static or hard-coded -they are adjusted upon each display of t

Re: Integer Form with Select Widget?

2014-10-25 Thread Farhan Khan
Any takers? I suspect that I need to mess around with the form during instantiation, but not sure how. On Saturday, October 25, 2014 12:29:45 PM UTC-4, Farhan Khan wrote: > > Hi all, > > I want to get an Integer value from the user through a forms.Form. I have > three unique requ

modelformset_factory generating "object has no attribute instance" error

2016-05-14 Thread Farhan Khan
I am trying to display a modelformset_factory in a view, but am running into this error and unable to figure out why. builtins.AttributeError AttributeError: 'IPAddressForm' object has no attribute 'instance' This seems to happen when I include this in my view: {{ ipaddressformset.as_table }} T

AUTH_PASSWORD_VALIDATORS not used when creating new users?

2016-06-27 Thread Farhan Khan
ive method to validate the password prior to creation? I am using Django 1.9.7 Thanks! --- Farhan Khan PGP Fingerprint: 4A78 F071 5CB6 E771 B8D6 3910 F371 FE22 3B20 B21B -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe

Re: Contribute to Django - Python 3 or Python 2

2016-06-28 Thread Farhan Khan
I switched from Python2 to Python3 because I needed my Django code to fire off some TLSv1.2 code, that python2 could not do. I barely notice the difference between the two except in very small syntax differences. When I switched from python2 to python3, I literally did this: find ./ -name "*.py

Re: AUTH_PASSWORD_VALIDATORS not used when creating new users?

2016-06-28 Thread Farhan Khan
know what you're doing. > If you want to open a documentation ticket, we could add a note about this. > > On Monday, June 27, 2016 at 9:29:56 PM UTC-4, Farhan Khan wrote: >> >> Hi all, >> >> I set the AUTH_PASSWORD_VALIDATORS variable to the standard set here

Re: AUTH_PASSWORD_VALIDATORS not used when creating new users?

2016-07-02 Thread Farhan Khan
; doesn't run validation (Model.clean()) anyway. > > If you're interested, here's the password validation design decisions > thread on django-developers: > https://groups.google.com/d/topic/django-developers/9GBhgGXmEKs/discussion > > On Tuesday, June 28, 2016 a

ManyToManyField('self') not using related_name

2016-07-19 Thread Farhan Khan
I am using a ManyToManyField whose target is a 'self' reference, but it does not create a related_name "reverse" field. Here is my model: class SecurityGroup(models.Model): name = models.CharField(max_length=100) description = models.TextField() subgroups = models.ManyToManyField('

Re: ManyToManyField('self') not using related_name

2016-07-19 Thread Farhan Khan
The solution was that I needed to set symmetrical=False, per the documentation here: https://docs.djangoproject.com/en/1.9/ref/models/fields/#django.db.models.ManyToManyField.symmetrical On Tuesday, July 19, 2016 at 2:52:16 PM UTC-4, Farhan Khan wrote: > > I am using a ManyToManyField

MultiWidget not rendering

2016-12-19 Thread Farhan Khan
Hi all! I am trying to get a MultiWidget with two TextFields ,however I am not able to get anything to render. Here is my code. from django import forms from django.forms import widgets class DateSelectorWidget(widgets.MultiWidget): def __init__(self, attrs=None): _widgets = (forms.T

Re: MultiWidget not rendering

2016-12-19 Thread Farhan Khan
Unfortunately that does not display. In the template I had it as {{ fourteen }} and saw it was rendering everything but my custom widget. -- Farhan Khan PGP Fingerprint: 4A78 F071 5CB6 E771 B8D6 3910 F371 FE22 3B20 B21B On Mon, Dec 19, 2016 at 2:02 PM, Matthew Pava wrote: > I’m not t

Re: MultiWidget not rendering

2016-12-25 Thread Farhan Khan
ata_list[0],''.join(data_list[1])) return None class ComplexFieldForm(forms.Form): field1 = ComplexField(widget=ComplexMultiWidget()) I took the solution from here: http://stackoverflow.com/a/2387330 I hope this help someone in the future! On Monday, December 19, 2016 at 12

Re: What determines initial number of forms in Django modelformset_factory?

2016-12-28 Thread Farhan Khan
I believe its the "extra" parameter. By default, the size is the number of objects you pass it. You can set that value to 0 by doing YourObject.objects.none() On Wednesday, December 28, 2016 at 7:17:31 AM UTC-5, Duane Gregory wrote: > > My model formset is producing an initial 7 forms, as seen he

Custom Widget for CharField Multiple

2016-12-28 Thread Farhan Khan
Hi, I am trying to create a `CharFieldMultiple`, equivalent to the MultipleHiddenInput or SelectMultiple. The goal is to have multiple CharField returned as a list, but have not been able to recreate it. My code thus far is: class CharFieldMultiple(forms.widgets.Input): def render(self, nam