Skip to content

Commit

Permalink
Merge pull request #29 from nthomas-mozilla/location-box
Browse files Browse the repository at this point in the history
Wider location box to make it easier for humans to edit (bug 639389)
  • Loading branch information
brandonsavage committed Aug 27, 2013
2 parents e8dc226 + 16b7f0c commit 1fcb0bb
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion apps/mirror/models.py
Expand Up @@ -2,6 +2,7 @@
from django.core.urlresolvers import reverse
from django.db import models
from django.utils.html import escape
from django.forms import TextInput

from product_details import product_details

Expand All @@ -10,6 +11,15 @@
LANG_CHOICES = [(key, "%s: %s" % (key, value['English']))
for key, value in product_details.languages.items()]

# This is to get a longer input box when entering locations
class LongDisplayCharField(models.CharField):
def formfield(self, **kwargs):
kwargs.update(
{"widget": TextInput(attrs={'style': 'width: 60em;'})}
)
return super(LongDisplayCharField, self).formfield(**kwargs)


class Mirror(models.Model):
"""A single mirror."""
id = models.AutoField(primary_key=True)
Expand Down Expand Up @@ -100,7 +110,7 @@ class Location(models.Model):
id = models.AutoField(primary_key=True)
product = models.ForeignKey('Product')
os = models.ForeignKey('OS', verbose_name='OS')
path = models.CharField(
path = LongDisplayCharField(
max_length=255, help_text=(
"Always use a leading slash.<br/>"
'The placeholder :lang will be replaced with the requested '
Expand Down

0 comments on commit 1fcb0bb

Please sign in to comment.