0

I am having a spacing issue with Django 1.6 (Python 2.7.13 x86).

I have a version number in my program, and the spacing looks bad...

class SoftwareAdmin(admin.ModelAdmin):

    fields = ('name', ('version1', 'version2', 'version3'))

    form = SoftwareAdminForm

class SoftwareAdminForm(forms.ModelForm):


    version1 = forms.CharField(max_length = 2, label = 'Version:', widget = forms.TextInput(attrs = {'size':2}))

    version2 = forms.CharField(max_length = 2, label = '.', widget = forms.TextInput(attrs = {'size':2, 'title': '.'}))

    version3 = forms.CharField(max_length = 2, label = '.', widget = forms.TextInput(attrs = {'size':2, 'title': '.'}))


    version1.initial = '0'

    version2.initial = '0'

    version3.initial = '0'

So, what I want is these three char fields to look nicer, and to get rid of all the space in between; I want version1, version2, and version3 to all be flush and right next to each other. How can I do this? Thanks.

Here, the first picture is how my code was rendered in part of the Admin Panel as of now... The second picture is what I am trying to achieve (I created it via paint)...

What I got What I want

Erik343
  • 323
  • 4
  • 14
  • 1
    Note that Django 1.6 has been entirely unsupported since April 15, 2015. _Please_ consider upgrading. – ChrisGPT was on strike Jul 04 '17 at 21:13
  • 1
    Just another note that there have been quite a few security and bug fixes since Django 1.6 went out of support. Here's a link to the currently supported versions, including LTS releases, which are supported for a minimum of three years: https://www.djangoproject.com/download/#supported-versions – FlipperPA Jul 05 '17 at 00:41
  • As for what you're trying to achieve, I believe you want to override the widget for the admin form: https://stackoverflow.com/questions/4176613/django-admin-using-a-custom-widget-for-only-one-model-field – FlipperPA Jul 05 '17 at 00:43

0 Answers0