These are chat archives for django/django

14th
Apr 2016
Dr M. Kaddour YAHYAOUI
@tuxador
Apr 14 2016 06:16
@megapctr i'll give it a try.
sumit sinha
@sumitsinha91
Apr 14 2016 07:19
addr_id = self.request.GET.get('address_id')
help how the process is working
Filip Figiel
@megapctr
Apr 14 2016 07:20
Request GET attribute is a queryDict
For the most part, it's similar to a regular dict
Dict has a method named get
It returns the value under the given key or None
Optionally, you can explicitly specify the fallback value as a second argument to the method
sumit sinha
@sumitsinha91
Apr 14 2016 10:31
what is query paramter
how i will use query parameter for below code
class AvailabilityVerifyWithAddressIdCountryServiceTestCase(TestCase):

    def test_address_id(self):
        url = 'http://dev.oms.fetchr.us/service/?addressid=5/'
        resp = self.client.get(url)
        self.assertEqual(resp.status_code, 200)

    def test_country_code(self):
        url = 'http://dev.oms.fetchr.us/service/?country=IN/'
        resp = self.client.get(url)
        self.assertEqual(resp.status_code, 200)

    def test_service_type(self):
        url = 'http://dev.oms.fetchr.us/service/?addressid=5/servicetype=&/'
        resp = self.client.get(url)
        self.assertEqual(resp.status_code, 200)
Zeeshan Asgar
@asgarzee
Apr 14 2016 13:40

hi guys ...

how i can retain the selected value of the select tag???? when i select a choice it redirects to the same page (because i set so) but the value of the select tag also refreshes...

def set_timezone(request):
    if request.method == 'POST':
        request.session['django_timezone'] = request.POST['timezone']
        return HttpResponseRedirect(request.META.get('HTTP_REFERER'))

here is the form:

{% get_current_timezone as TIME_ZONE %}
    <form action="{% url 'set_timezone' %}" method="POST">
        {% csrf_token %}
        <label for="timezone">Time zone:</label>
        <select name="timezone" id="tzone" onchange="javascript:form.submit()">
            <!--{% for tz in timezones %}-->
            <!--<option value="{{ tz }}"{% if tz == TIME_ZONE %} selected="selected"{% endif %}>{{ tz }}</option>-->
            <!--{% endfor %}-->
        </select>
        <!--<input type="submit" value="Set" />-->
    </form>

i m getting the value in django session but display is the problem.

Puneet Aggarwal
@puneetagg
Apr 14 2016 15:39
Hi..
I need python-requests for python-social-auth but pip is not upgrading it. Tried methods on google but none worked.
Michal Haták
@Twista
Apr 14 2016 16:03
pip install -U pip does not work ? whats the output ?
samkurma
@samkurma
Apr 14 2016 16:14
I am getting this from the Django-registration HMAC when i trying to register and get success url:
NoReverseMatch: Reverse for '' with arguments '('InNhbWt1cm1hNjZAZ21haWwuY29tIg:1aqiix:okb8xJcNaPGpRBXTvM_-rrKeql8',)' and keyword arguments '{}' not found. 0 pattern(s) tried: []
could u please help me in that?
Michal Haták
@Twista
Apr 14 2016 16:15
u have probably wrong url in urls definition
samkurma
@samkurma
Apr 14 2016 16:16
these are the my urls:
url(r'^accounts/register/$', views.CustomRegistrationView.as_view(form_class=MyRegForm),
name='registration_register'),
url(r'^', include('registration.backends.hmac.urls')),
class CustomRegistrationView(RegistrationView):
def get_success_url(self, request):
    success_url =  '/register/complete/' 
    return success_url
Mauro Oviedo
@moviedo
Apr 14 2016 16:19
try moving url(r'^', include('registration.backends.hmac.urls')), tot he top of the urls pattern
@samkurma
tell us what u get
samkurma
@samkurma
Apr 14 2016 16:37
same error:
Reverse for '' with arguments '('InNhbWt1cm1hNjZAZ21haWwuY29tIg:1aqkGN:pPQgg_7stRRXNR9RlCwidy3ziQ0',)' and keyword arguments '{}' not found. 0 pattern(s) tried: []
Any idea please
samkurma
@samkurma
Apr 14 2016 16:59

Error during template rendering

In template /home/sambaiah/nikhil/bits/admission/templates/registration/activation_email.txt, error at line 4

{% url registration_activate activation_key %}
what should i send it as activation_key?
Puneet Aggarwal
@puneetagg
Apr 14 2016 17:38
@Twista Not uninstalling pip at /usr/lib/python2.7/dist-packages, owned by OS
But resolved it by creating virtualenv and installing packages there..
samkurma
@samkurma
Apr 14 2016 17:39
@puneetagg can you please help in the above problem?
Puneet Aggarwal
@puneetagg
Apr 14 2016 17:40
@Twista Needed latest package for python-social-auth..but its still giving same error
    from requests.packages.urllib3.poolmanager import PoolManager
ImportError: No module named packages.urllib3.poolmanager
@samkurma I am not much good at templating as I am using django-rest-framework.
@samkurma Also as I see, your file has .txt as extension.
samkurma
@samkurma
Apr 14 2016 17:44
yes we are handling it to send a mail context
Puneet Aggarwal
@puneetagg
Apr 14 2016 18:23
@samkurma ok..