translations fixed

This commit is contained in:
ARvind Tiwari 2017-07-29 18:19:10 +05:30
parent 925252f1c9
commit c4ee89f6b8
4 changed files with 1529 additions and 213 deletions

View file

@ -13,7 +13,6 @@ def generate_ssh_key_name():
return 'dcl-generated-key-' + datetime.datetime.now().strftime('%m%d%y%H%M') return 'dcl-generated-key-' + datetime.datetime.now().strftime('%m%d%y%H%M')
class HostingUserLoginForm(forms.Form): class HostingUserLoginForm(forms.Form):
email = forms.CharField(widget=forms.EmailInput()) email = forms.CharField(widget=forms.EmailInput())
@ -27,9 +26,11 @@ class HostingUserLoginForm(forms.Form):
password = self.cleaned_data.get('password') password = self.cleaned_data.get('password')
is_auth = authenticate(email=email, password=password) is_auth = authenticate(email=email, password=password)
if not is_auth: if not is_auth:
raise forms.ValidationError("Your username and/or password were incorrect.") raise forms.ValidationError(
"Your username and/or password were incorrect.")
elif is_auth.validated == 0: elif is_auth.validated == 0:
raise forms.ValidationError(_("Your account is not activated yet.")) raise forms.ValidationError(
_("Your account is not activated yet."))
return self.cleaned_data return self.cleaned_data
def clean_email(self): def clean_email(self):
@ -66,13 +67,13 @@ class HostingUserSignupForm(forms.ModelForm):
class UserHostingKeyForm(forms.ModelForm): class UserHostingKeyForm(forms.ModelForm):
private_key = forms.CharField(widget=forms.HiddenInput(), required=False) private_key = forms.CharField(widget=forms.HiddenInput(), required=False)
public_key = forms.CharField(widget=forms.Textarea( public_key = forms.CharField(widget=forms.Textarea(
attrs={'class': 'form_public_key', 'placeholder': 'Paste here your public key'}), attrs={'class': 'form_public_key', 'placeholder': _('Paste here your public key')}),
required=False, required=False,
) )
user = forms.models.ModelChoiceField(queryset=CustomUser.objects.all(), user = forms.models.ModelChoiceField(queryset=CustomUser.objects.all(),
required=False, widget=forms.HiddenInput()) required=False, widget=forms.HiddenInput())
name = forms.CharField(required=False, widget=forms.TextInput( name = forms.CharField(required=False, widget=forms.TextInput(
attrs={'class': 'form_key_name', 'placeholder': 'Give a name to your key'})) attrs={'class': 'form_key_name', 'placeholder': _('Give a name to your key')}))
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
self.request = kwargs.pop("request") self.request = kwargs.pop("request")

File diff suppressed because it is too large Load diff

View file

@ -7,7 +7,7 @@
<div class="col-md-12"> <div class="col-md-12">
<div class="col-sm-12"> <div class="col-sm-12">
<h2><i class="fa fa-key" aria-hidden="true"></i>&nbsp;{% trans "SSH Key"%}</h2> <h2><i class="fa fa-key" aria-hidden="true"></i>&nbsp;{% trans "SSH Key"%}</h2>
<h4>{% trans "Choose a key option in order to access your VMs." %}</h4> <h4>{% trans "Choose a key option in order to access your VM" %}.</h4>
{% if messages %} {% if messages %}
<div class="alert alert-warning"> <div class="alert alert-warning">
{% for message in messages %} {% for message in messages %}
@ -17,7 +17,7 @@
{% endif %} {% endif %}
<div class="choice-container"> <div class="choice-container">
<div class="left-choice-container"> <div class="left-choice-container">
<h3>{% trans "I want to generate a new key pair"%}</h3> <h3>{% trans "I want to generate a new key pair" %}.</h3>
<form action="#" method="post"> <form action="#" method="post">
{% csrf_token %} {% csrf_token %}
<button type="submit" class="btn btn-success choice-button generate-btn"> <button type="submit" class="btn btn-success choice-button generate-btn">

View file

@ -21,13 +21,13 @@
{% endfor %} {% endfor %}
{% buttons %} {% buttons %}
<div class="underform-contaner"> <div class="underform-contaner">
<h4>{% trans "Use your created key to access to the machine." %}</h4> <h4>{% trans "Use your created key to access to the VM" %}.</h4>
<button type="submit" name='add_ssh' class="btn btn-success custom_form_button"> <button type="submit" name='add_ssh' class="btn btn-success custom_form_button">
{% trans "Add SSH key"%} {% trans "Add SSH key"%}
</button> </button>
</div> </div>
<div class="underform-contaner"> <div class="underform-contaner">
<h4>{% trans "Or you can generate a new key pair."%}</h4> <h4>{% trans "Or you can generate a new key pair"%}.</h4>
<button type="submit" name='generate' class="btn btn-default custom_form_button">{% trans "Generate"%} <button type="submit" name='generate' class="btn btn-default custom_form_button">{% trans "Generate"%}
</button> </button>
</div> </div>
@ -39,7 +39,7 @@
{% if private_key %} {% if private_key %}
<div class="alert alert-warning"> <div class="alert alert-warning">
<strong>{% trans "Warning!"%}</strong>{% trans "You can download your SSH private key once. Don't lost your key"%} <strong>{% trans "Warning!"%}</strong>{% trans "You can download your SSH private key once. Don't loose your key" %}
</div> </div>
<div class="form-group"> <div class="form-group">
<textarea class="form-control" rows="6" id="ssh_key" type="hidden" style="display:none">{{private_key}}</textarea> <textarea class="form-control" rows="6" id="ssh_key" type="hidden" style="display:none">{{private_key}}</textarea>