Re: mathematical function and django connect

2016-02-22 Thread James Schneider
On Sun, Feb 21, 2016 at 9:33 PM, Xristos Xristoou  wrote:

> i find it,just add return render_to_response('blog/calc.html', {'a'
> :a},context_instance=RequestContext(request))
> and dont show me that error,but not work again
> now if i touch calc button just reload dont show me error dont show me
> results only clear numbers why ?
>
>
Not sure what you mean by 'clear numbers'. Are saying that the results are
being shown, but not styled in any way?


> {% csrf_token %}
>   Number of number: 
>   Enter a value: 
>   
> calc
> 
> 
> 
> 
> {{ a }}
> or full info
> {% for sm in a%}
> {{ sm }}
> {% endfor %}
> 
> 
>
>
>
If you have multiple values in 'a', then it will show all of those values
on a single line separated by spaces, I believe. In fact, it will likely
show them twice since you have {{ a }} and a {% for %} loop running through
'a'.

You'll have to add your own HTML styling within your template if you want
them to look different in the browser.

-James

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2Be%2BciXY17xrpS4x%2BYeE6hdE8RRYkJp7Cn0LAbD%3DJTLwMsiyeQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Django authentication

2016-02-22 Thread Wilfreid Mpunia
Good day, I have the following question.
I'm still learning and improving my django level, but I'm a bite confused 
with a project that I'm working on.

For a django web app, which requires a user to register with their email 
and password, I used the custom user and backend as shown the djangoproject 
website. 

However, later on I realised that  the app will have to make some api call 
with basic auth, which I assumes will be the registered user email and 
password.

My questions is the following:
 -  does it really make sense two have those two authentications? because 
I'm thinking to remove the django one, and rather use the 
django_rest_framework auth.


Any advise will be helpful to me

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/64b7b5ea-9363-4bf2-8634-769886eaf2e2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Invoke not right worked

2016-02-22 Thread Seti Volkylany
Almost all worked

http://eugenelysenko.pythonanywhere.com/

Thank you very much

On Sun, Feb 21, 2016 at 10:55 PM, James Schneider 
wrote:

> On Sun, Feb 21, 2016 at 12:25 PM,  wrote:
>
>>
>> *my file with invoke-task (tasks.py)*
>> .
>> from invoke import run, task
>>
>> separeted_line = eval('\'*\'*50')
>> sample = "\n{0}\n*** Finished: {1} ***\n{0}\n"
>>
>>
>> @task
>> def run_stadalone_configure():
>> command = './manage.py collectstatic --noinput'
>> print(sample.format(separeted_line, command.upper()))
>> run(command)
>> command = './manage.py compilemessages'
>> run(command)
>> print(sample.format(separeted_line, command.upper()))
>> command = './manage.py migrate'
>> run(command)
>> print(sample.format(separeted_line, command.upper()))
>> # command = './manage.py createsuperuser --username=wlysenko --email=
>> setivolkyl...@gmail.com'
>> # run(command)
>> # print(sample.format(separeted_line, command.upper()))
>>
>
>
> I'm not familiar with Heroku specifically, perhaps they support doing
> this, but you should probably run your Django management commands using the
> guide here rather than trying to coerce command line arguments (which can
> lead to shell escaping issues, and might be what is causing the error
> below).
>
>
> https://docs.djangoproject.com/es/1.9/ref/django-admin/#running-management-commands-from-your-code
>
>
>
>> Superuser creation skipped due to not running in a TTY. You can run
>> `manage.py createsuperuser` in your project to create one manually.
>> Traceback (most recent call last):
>>   File "./manage.py", line 10, in 
>> execute_from_command_line(sys.argv)
>>   File
>> "/home/wlysenko/.virtualenvs/heroku_project_brat/lib/python3.4/site-packages/django/core/management/__init__.py",
>> line 350, in execute_from_command_line
>> utility.execute()
>>   File
>> "/home/wlysenko/.virtualenvs/heroku_project_brat/lib/python3.4/site-packages/django/core/management/__init__.py",
>> line 342, in execute
>> self.fetch_command(subcommand).run_from_argv(self.argv)
>>   File
>> "/home/wlysenko/.virtualenvs/heroku_project_brat/lib/python3.4/site-packages/django/core/management/base.py",
>> line 348, in run_from_argv
>> self.execute(*args, **cmd_options)
>>   File
>> "/home/wlysenko/.virtualenvs/heroku_project_brat/lib/python3.4/site-packages/django/contrib/auth/management/commands/createsuperuser.py",
>> line 52, in execute
>> return super(Command, self).execute(*args, **options)
>>   File
>> "/home/wlysenko/.virtualenvs/heroku_project_brat/lib/python3.4/site-packages/django/core/management/base.py",
>> line 399, in execute
>> output = self.handle(*args, **options)
>>   File
>> "/home/wlysenko/.virtualenvs/heroku_project_brat/lib/python3.4/site-packages/django/contrib/auth/management/commands/createsuperuser.py",
>> line 173, in handle
>>
>> self.UserModel._default_manager.db_manager(database).create_superuser(**user_data)
>> *TypeError: create_superuser() missing 1 required positional argument:
>> 'email'*
>>
>
> I suspect a shell escape issue here with the @ symbol in the email, but it
> would be hard to tell. You'd be better off rewriting your management
> commands per the link I sent so that the escaping is handled correctly.
>
> On a side note, creating a superuser this way is probably not ideal. Even
> if it did succeed, the superuser wouldn't have a password and you'd have to
> give it one manually anyway.
>
> https://docs.djangoproject.com/es/1.9/ref/django-admin/#createsuperuser
>
> In cases like this where the initial user is being created via a script, I
> import the Django environment and use the ORM to create the user manually
> (with a password) and set is_super = True.
>
> -James
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/IYBFDy1Tiaw/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CA%2Be%2BciW%3DMK9Ea-B97SGYqg8GpoDo1g2ievfj9poX26%3D2CyfnOA%40mail.gmail.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this

Re: Django authentication

2016-02-22 Thread Avraham Serour
AFAIK DRF uses the django auth

On Mon, Feb 22, 2016 at 3:36 PM, Wilfreid Mpunia 
wrote:

> Good day, I have the following question.
> I'm still learning and improving my django level, but I'm a bite confused
> with a project that I'm working on.
>
> For a django web app, which requires a user to register with their email
> and password, I used the custom user and backend as shown the djangoproject
> website.
>
> However, later on I realised that  the app will have to make some api call
> with basic auth, which I assumes will be the registered user email and
> password.
>
> My questions is the following:
>  -  does it really make sense two have those two authentications? because
> I'm thinking to remove the django one, and rather use the
> django_rest_framework auth.
>
>
> Any advise will be helpful to me
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/64b7b5ea-9363-4bf2-8634-769886eaf2e2%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFWa6tK-hLKkHJS_mpT_Xb0ndA52POcYMS9mWLVDoCNxgE2Mvg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django authentication

2016-02-22 Thread Wilfreid Mpunia
why if I may ask

On Monday, February 22, 2016 at 4:24:05 PM UTC+2, Avraham Serour wrote:
>
> AFAIK DRF uses the django auth
>
> On Mon, Feb 22, 2016 at 3:36 PM, Wilfreid Mpunia  > wrote:
>
>> Good day, I have the following question.
>> I'm still learning and improving my django level, but I'm a bite confused 
>> with a project that I'm working on.
>>
>> For a django web app, which requires a user to register with their email 
>> and password, I used the custom user and backend as shown the djangoproject 
>> website. 
>>
>> However, later on I realised that  the app will have to make some api 
>> call with basic auth, which I assumes will be the registered user email and 
>> password.
>>
>> My questions is the following:
>>  -  does it really make sense two have those two authentications? because 
>> I'm thinking to remove the django one, and rather use the 
>> django_rest_framework auth.
>>
>>
>> Any advise will be helpful to me
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/64b7b5ea-9363-4bf2-8634-769886eaf2e2%40googlegroups.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/bb61975b-2dd4-4ed7-a601-34c713309792%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Migrate Data from Django 1.4 to Django 1.8

2016-02-22 Thread Mayur Tanna


Hi,


We have migrated the Django 1.4 application to Django 1.8 successfully. The 
Django 1.4 version of applicaiton is still in use in production until we go 
live with Django 1.8. The problem is that lots of data have been updated on 
production server which needs to be migrated to 1.8 version on local 
enviroment. Is there any way I can migrate the data from database of 1.4 to 
1.8 except manually doing that? Note that the model/database columns are 
different in both the version.

Can anybody suggest some good options ?


Thanks.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/b9837af1-5ccd-46b1-9a80-b28712922923%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Migrate Data from Django 1.4 to Django 1.8

2016-02-22 Thread Andreas Kuhne
Hi,

I did that a while back, I wrote my own SQL migration script that we tested
with the production database in development. I think that would be the only
way. Django doesn't know of the changes that you have made in your database
models. However if you had started with the production database and then
migrated up to the new layout in development, then that would have been
possible.

Regards,

Andréas

2016-02-22 15:18 GMT+01:00 Mayur Tanna :

> Hi,
>
>
> We have migrated the Django 1.4 application to Django 1.8 successfully.
> The Django 1.4 version of applicaiton is still in use in production until
> we go live with Django 1.8. The problem is that lots of data have been
> updated on production server which needs to be migrated to 1.8 version on
> local enviroment. Is there any way I can migrate the data from database of
> 1.4 to 1.8 except manually doing that? Note that the model/database columns
> are different in both the version.
>
> Can anybody suggest some good options ?
>
>
> Thanks.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/b9837af1-5ccd-46b1-9a80-b28712922923%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CALXYUb%3DpOSD8JuJNyt6tMNd31XmAuDxEL9wYNGhGJTP9LfbjGg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: form as filter in admin site

2016-02-22 Thread Luis Zárate
I need something like this, of course magic is in FormFilter :), so I am
lookig for something in admin app with this behaivor


class MatriculaForm(forms.Form):
# I am using django-ajax-selects, lookups are out of scope
disciplina = AutoCompleteSelectMultipleField('disciplinas',
 required=False,
 help_text=None)
ciclo = forms.ModelMultipleChoiceField(queryset=Ciclo.objects.all(),
   required=False)
proyecto = AutoCompleteSelectMultipleField('proyectos',
   required=False,
   help_text=None)



class MatriculaFilter(FormFilter):
template = "matriculafilter/filter_template.html"
form = MatriculaForm
title = "Matricula Filter"
# Needs for autocomplete fields that insert other input
remove_params = ['filtro', 'disciplina_text', 'proyecto_text']
#Map form fields with model fields for example FK relations
map_parameters = {'ciclo': 'proyeccion__ciclo'}



class MatriculaAdmin(admin.ModelAdmin)
list_filter = (
   MatriculaFilter,
   )

2016-02-20 9:56 GMT-06:00 Luis Zárate :

> I am trying to insert a filter in the admin site that have 2 autocomplete
> inputs so I was thinking to do  passed a form  with a custom filter, but I
> only find a list filter documentation.
>
> I solved the problem writing a custom filter, with a little problem with
> css, because change list view  has few width space for filter so input
> looks terrible.
>
> i needed to search in the django code because i didn't find in
> documentation.
>
> I think my solution is generic so I am asking me if django has this
> functionally implemented, I didn't find but maybe you know something about.
>
> --
> "La utopía sirve para caminar" Fernando Birri
>
>
>
>


-- 
"La utopía sirve para caminar" Fernando Birri

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAG%2B5VyN-aRsTn06BmFaJjG0JP_-f5X7J4eH0%3DyB5ziAEFRmd5A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
from django.contrib import admin

class FormFilter(admin.ListFilter):
template = "formfilter/filter_template.html"
form = None
form_instance = None
remove_params = []
map_parameters = None  # {}
delimeter = "|"

def _get_map_filter(self):
if self.map_parameters is None:
self.map_parameters = {}
for param in self._get_parameter_name():
if param not in self.map_parameters:
self.map_parameters[param] = param
return self.map_parameters

def get_map_filter(self):
""" Overwrite this function to provide new map params
def get_map_filter(self):
dev = super(MyClass, self).get_map_filter
dev['myparam'] = 'query_set_param'
return dev
"""
return self._get_map_filter()

def _get_parameter_name(self, request=None):
if self.form_instance is None:
if request is not None:
self.form_instance = self.form(request.GET)
else:
self.form_instance = self.form()
return self.form_instance.fields.keys()

def __init__(self, request, params, model, model_admin):

self.used_parameters = {}
# intentional comment this line
# super(FormFilter, self).__init__(
#request, params, model, model_admin)
if self.form is None:
raise ImproperlyConfigured(
"The form filter '%s' does not specify "
"a 'form'." % self.__class__.__name__)

for parameter_name in self._get_parameter_name(request):
if parameter_name in params:
value = params.pop(parameter_name)
self.used_parameters[parameter_name] = value

for param in self.remove_params:
if param in params:
params.pop(param)

def has_output(self):
return True

def value(self):
"""
Returns the value (in string format) provided in the request's
query string for this filter, if any. If the value wasn't provided then
returns None.
"""
return None  # I not sure what is doing here.

def expected_parameters(self):
return self._get_parameter_name()

def choices(self, cl):
yield {'title': self.title,
   'form': self.form_instance
   }

def

Re: Possible Bug when using exclude on a GenericForeignKey / GenericRelation query.

2016-02-22 Thread Tim Graham
The crash is probably a bug: https://code.djangoproject.com/ticket/26261

On Friday, August 14, 2015 at 5:01:30 PM UTC-4, Daniel H wrote:
>
> Hi everyone.
>
> I've been using django for almost a year now, but it's my first time 
> posting here.
>
> Anyway, I'm encountering an error which I think might be a bug. I've yet 
> to try and replicate it as I thought posting here would be the better first 
> step, as I might just be doing something incorrectly.
>
> When I try a query with .exclude() on a table with a GenericForeignKey and 
> a reverse Generic Relation on a different table, I get this:
>
> AttributeError at /list
>
> 'GenericRelation' object has no attribute 'field'
>
>
> Here is a mock up of my database structure:
>
> class InternalOffer(models.Model):
> user = models.ForeignKey('User')
> status = models.CharField(max_length=64)
> (more offer data...)
> relation = GenericRelation(OfferJoin, related_query_name='offerquery')
>
> class ExternalOffer(models.Model):
> user = models.ForeignKey('User')
> status = models.CharField(max_length=64)
> (more offer data...)
> relation = GenericRelation(OfferJoin, related_query_name='offerquery')
>
> class OfferJoin(models.Model):
> content_type = models.ForeignKey(ContentType)
> object_id = models.PositiveIntegerField()
> offer = GenericForeignKey('content_type', 'object_id')
>
> I can filter fine, it's only the exclude that causes errors. Here is the 
> code that causes the error:
>
> offers = OfferCover.objects.filter(offerquery__user__id=request.user.id)
> offers = offers.exclude(offerquery__status="Completed")
>
> Here's the full callback:
>
> Django Version: 1.8.2
> Python Version: 2.7.6
>
> Traceback:
> File "/Library/Python/2.7/site-packages/django/core/handlers/base.py" in 
> get_response
>   132. response = wrapped_callback(request, 
> *callback_args, **callback_kwargs)
> File "/Library/Python/2.7/site-packages/django/contrib/auth/decorators.py" 
> in _wrapped_view
>   22. return view_func(request, *args, **kwargs)
> File "/Users/path-to-project/project/views.py" in list
>   136. offers = offers.exclude(o__status="Completed")
> File "/Library/Python/2.7/site-packages/django/db/models/query.py" in 
> exclude
>   686. return self._filter_or_exclude(True, *args, **kwargs)
> File "/Library/Python/2.7/site-packages/django/db/models/query.py" in 
> _filter_or_exclude
>   695. clone.query.add_q(~Q(*args, **kwargs))
> File "/Library/Python/2.7/site-packages/django/db/models/sql/query.py" in 
> add_q
>   1304. clause, require_inner = self._add_q(where_part, 
> self.used_aliases)
> File "/Library/Python/2.7/site-packages/django/db/models/sql/query.py" in 
> _add_q
>   1332. allow_joins=allow_joins, split_subq=split_subq,
> File "/Library/Python/2.7/site-packages/django/db/models/sql/query.py" in 
> build_filter
>   1180.   can_reuse, e.names_with_path)
> File "/Library/Python/2.7/site-packages/django/db/models/sql/query.py" in 
> split_exclude
>   1562. trimmed_prefix, contains_louter = 
> query.trim_start(names_with_path)
> File "/Library/Python/2.7/site-packages/django/db/models/sql/query.py" in 
> trim_start
>   1989. join_field = path.join_field.field
>
> Exception Type: AttributeError at /list
> Exception Value: 'GenericRelation' object has no attribute 'field'
>
> I've read the documentation multiple times and haven't come across 
> anything usefull. I know that filtering GFKs alone won't work, but both 
> filtering and excluding should work with the reverse Generic Relation.
>
> Thanks!
> - Daniel Harris
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/48d989fe-a97c-4792-bb80-7dd8fa767915%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: key specification without a key length

2016-02-22 Thread Sammi Singh
Thanks Mike,

I'm using models and I made the changes like you suggested but I'm still 
getting the same error

*id = models.CharField(max_length=99, primary_key=True)*

*python manage.py makemigrations talk*

*Migrations for 'talk':*

  *0008_auto_20160222_1925.py*:

- Remove field ids from userconfig

- Add field id to userconfig

- Alter field id on steps


*python manage.py migrate talk*

*Operations to perform:*

*  Apply all migrations: *talk

*Running migrations:*

  Rendering model states...* DONE*

  Applying talk.0003_steps...Traceback (most recent call last):

  File "manage.py", line 10, in 

execute_from_command_line(sys.argv)

  File 
"/Library/Python/2.7/site-packages/django/core/management/__init__.py", 
line 353, in execute_from_command_line

utility.execute()

  File 
"/Library/Python/2.7/site-packages/django/core/management/__init__.py", 
line 345, in execute

self.fetch_command(subcommand).run_from_argv(self.argv)

  File "/Library/Python/2.7/site-packages/django/core/management/base.py", 
line 348, in run_from_argv

self.execute(*args, **cmd_options)

  File "/Library/Python/2.7/site-packages/django/core/management/base.py", 
line 399, in execute

output = self.handle(*args, **options)

  File 
"/Library/Python/2.7/site-packages/django/core/management/commands/migrate.py", 
line 200, in handle

executor.migrate(targets, plan, fake=fake, fake_initial=fake_initial)

  File 
"/Library/Python/2.7/site-packages/django/db/migrations/executor.py", line 
92, in migrate

self._migrate_all_forwards(plan, full_plan, fake=fake, 
fake_initial=fake_initial)

  File 
"/Library/Python/2.7/site-packages/django/db/migrations/executor.py", line 
121, in _migrate_all_forwards

state = self.apply_migration(state, migration, fake=fake, 
fake_initial=fake_initial)

  File 
"/Library/Python/2.7/site-packages/django/db/migrations/executor.py", line 
198, in apply_migration

state = migration.apply(state, schema_editor)

  File 
"/Library/Python/2.7/site-packages/django/db/migrations/migration.py", line 
123, in apply

operation.database_forwards(self.app_label, schema_editor, old_state, 
project_state)

  File 
"/Library/Python/2.7/site-packages/django/db/migrations/operations/models.py", 
line 59, in database_forwards

schema_editor.create_model(model)

  File 
"/Library/Python/2.7/site-packages/django/db/backends/base/schema.py", line 
284, in create_model

self.execute(sql, params or None)

  File 
"/Library/Python/2.7/site-packages/django/db/backends/base/schema.py", line 
110, in execute

cursor.execute(sql, params)

  File "/Library/Python/2.7/site-packages/django/db/backends/utils.py", 
line 79, in execute

return super(CursorDebugWrapper, self).execute(sql, params)

  File "/Library/Python/2.7/site-packages/django/db/backends/utils.py", 
line 64, in execute

return self.cursor.execute(sql, params)

  File "/Library/Python/2.7/site-packages/django/db/utils.py", line 95, in 
__exit__

six.reraise(dj_exc_type, dj_exc_value, traceback)

  File "/Library/Python/2.7/site-packages/django/db/backends/utils.py", 
line 62, in execute

return self.cursor.execute(sql)

  File 
"/Library/Python/2.7/site-packages/django/db/backends/mysql/base.py", line 
112, in execute

return self.cursor.execute(query, args)

  File "/Library/Python/2.7/site-packages/MySQLdb/cursors.py", line 205, in 
execute

self.errorhandler(self, exc, value)

  File "/Library/Python/2.7/site-packages/MySQLdb/connections.py", line 36, 
in defaulterrorhandler

raise errorclass, errorvalue

django.db.utils.OperationalError: (1170, "BLOB/TEXT column 'id' used in key 
specification without a key length")


On Friday, February 19, 2016 at 1:30:46 PM UTC-8, Sammi Singh wrote:
>
> Hi,
>
> I'm new to Django and facing this error "*django.db.utils.OperationalError: 
> (1170, "BLOB/TEXT column 'id' used in key specification without a key 
> length")*"
>
> Here is my code:
>
> class Steps(models.Model):
>
> author = models.ForeignKey(User)
>
> #id = models.TextField(primary_key=True)
>
> id = models.CharField(primary_key=True, max_length = 32)
>
> text = models.TextField()
>
> status = models.TextField()
>
> step_id = models.TextField(null=True)
>
> release_id = models.TextField(null=True)
>
> region = models.TextField(null=True)
>
> # Time is a rhinocerous
>
> updated = models.DateTimeField(auto_now=True)
>
> created = models.DateTimeField(auto_now_add=True)
>
>
> class UserConfig(models.Model):
>
> author = models.ForeignKey(User)
>
> #id = models.TextField(primary_key=True)
>
> id = models.CharField(primary_key=True, max_length = 32)
>
> co_range = models.TextField()
>
> tu_range = models.TextField()
>
> st_range = models.TextField()
>
> de_host = models.TextField()
>
> in_host1 = models.TextField()
>
> in_host2 = models.TextField()
>
> in_host3 = models.TextField()
>
> co

Re: mathematical function and django connect

2016-02-22 Thread Xristos Xristoou
the problem in the html form we need to change second input to 
take multiple values,for example first input take a number
and the second input take many numbers..if the first number = 2 then take 
second input two numbers,two fields for input i try this but not work

orm action="" method="POST">{% csrf_token %}
  Number of number: 
  calc
  {% for i in total_inputs %}
 Enter a value: 
calc
  {% endfor %}

show me error in the {% for i in total_inputs %}
Τη Τρίτη, 9 Φεβρουαρίου 2016 - 9:47:30 μ.μ. UTC+2, ο χρήστης Xristos 
Xristoou έγραψε:
>
> hello,
>
>
> i create some python mathematical function on python idle,
> i want to create website where the user import value numbers on the 
> function
> and take the results from that.
> question one,how to connect my mathematical function on the django?
> question two,how to connect input and output from the scipts in the 
> website ?
> the second question i ask because input and output from the function is a 
> dynamic define from the user
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/fbeed832-5a26-4863-a39c-a376cf9c8600%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: key specification without a key length

2016-02-22 Thread Mike Dewhirst

On 23/02/2016 6:37 AM, Sammi Singh wrote:

Thanks Mike,

I'm using models and I made the changes like you suggested but I'm still
getting the same error

*id = models.CharField(max_length=99, primary_key=True)*


That was a stab in the dark trying to indicate to you that a text field 
is inappropriate as a key field.


I also indicated that it is unusual to even use a char field as primary 
key. You would want to be certain such a path is necessary. It is also 
highly unusual to want a primary key to carry specific business data 
such as might be your intention.


Before expending effort on fixing the problem*, can you explain why you 
want to control the primary key yourself instead of giving that task to 
Django's built-in primary key?


* The last line of the traceback indicates the migration failed then 
naturally rolled the transaction back and left your database with an 
unchanged text (blob) field as primary key. Why it failed I don't know 
but there is probably an easier solution.


Mike




/python manage.py makemigrations talk/

*Migrations for 'talk':*

 *0008_auto_20160222_1925.py*:

    - Remove field ids from userconfig

    - Add field id to userconfig

    - Alter field id on steps


/python manage.py migrate talk/

*Operations to perform:*

*Â  Apply all migrations: *talk

*Running migrations:*

  Rendering model states...*DONE*

  Applying talk.0003_steps...Traceback (most recent call last):

  File "manage.py", line 10, in 

    execute_from_command_line(sys.argv)

  File
"/Library/Python/2.7/site-packages/django/core/management/__init__.py",
line 353, in execute_from_command_line

    utility.execute()

  File
"/Library/Python/2.7/site-packages/django/core/management/__init__.py",
line 345, in execute

    self.fetch_command(subcommand).run_from_argv(self.argv)

  File
"/Library/Python/2.7/site-packages/django/core/management/base.py", line
348, in run_from_argv

    self.execute(*args, **cmd_options)

  File
"/Library/Python/2.7/site-packages/django/core/management/base.py", line
399, in execute

    output = self.handle(*args, **options)

  File
"/Library/Python/2.7/site-packages/django/core/management/commands/migrate.py",
line 200, in handle

    executor.migrate(targets, plan, fake=fake, fake_initial=fake_initial)

  File
"/Library/Python/2.7/site-packages/django/db/migrations/executor.py",
line 92, in migrate

    self._migrate_all_forwards(plan, full_plan, fake=fake,
fake_initial=fake_initial)

  File
"/Library/Python/2.7/site-packages/django/db/migrations/executor.py",
line 121, in _migrate_all_forwards

    state = self.apply_migration(state, migration, fake=fake,
fake_initial=fake_initial)

  File
"/Library/Python/2.7/site-packages/django/db/migrations/executor.py",
line 198, in apply_migration

    state = migration.apply(state, schema_editor)

  File
"/Library/Python/2.7/site-packages/django/db/migrations/migration.py",
line 123, in apply

    operation.database_forwards(self.app_label, schema_editor,
old_state, project_state)

  File
"/Library/Python/2.7/site-packages/django/db/migrations/operations/models.py",
line 59, in database_forwards

    schema_editor.create_model(model)

  File
"/Library/Python/2.7/site-packages/django/db/backends/base/schema.py",
line 284, in create_model

    self.execute(sql, params or None)

  File
"/Library/Python/2.7/site-packages/django/db/backends/base/schema.py",
line 110, in execute

    cursor.execute(sql, params)

  File "/Library/Python/2.7/site-packages/django/db/backends/utils.py",
line 79, in execute

    return super(CursorDebugWrapper, self).execute(sql, params)

  File "/Library/Python/2.7/site-packages/django/db/backends/utils.py",
line 64, in execute

    return self.cursor.execute(sql, params)

  File "/Library/Python/2.7/site-packages/django/db/utils.py", line 95,
in __exit__

    six.reraise(dj_exc_type, dj_exc_value, traceback)

  File "/Library/Python/2.7/site-packages/django/db/backends/utils.py",
line 62, in execute

    return self.cursor.execute(sql)

  File
"/Library/Python/2.7/site-packages/django/db/backends/mysql/base.py",
line 112, in execute

    return self.cursor.execute(query, args)

  File "/Library/Python/2.7/site-packages/MySQLdb/cursors.py", line
205, in execute

    self.errorhandler(self, exc, value)

  File "/Library/Python/2.7/site-packages/MySQLdb/connections.py", line
36, in defaulterrorhandler

    raise errorclass, errorvalue

django.db.utils.OperationalError: (1170, "BLOB/TEXT column 'id' used in
key specification without a key length")



On Friday, February 19, 2016 at 1:30:46 PM UTC-8, Sammi Singh wrote:

Hi,

I'm new to Django and facing this error
"*/django.db.utils.OperationalError: (1170, "BLOB/TEXT column 'id'
used in key specification without a key length")/*"

Here is my code:

class Steps(models.Model):

    author = models.ForeignKey(User)

#Â  Â  id = models.TextField(primary_ke

crispy form styling of unconventional upload mechanism

2016-02-22 Thread clarksonchris81


I have made an upload form button, that I need to be able to refers to tin 
my css code such that I can centre it on the web page. However the upload 
button is not constituted by any bootstrap like "btn" syntax, which is 
prevalent in example code. Instead is constituted by the following code:

#forms.py

class DocumentForm(forms.Form):
docfile = forms.FileField(label='Select a  BAM file')

### no class or model declared

And so I have taken some example code that I have tried to adapt into to my 
own code below and properly indented from the above code in forms.py.

def __init__(self, *args, **kwargs):
   super(INSERT_TYPE, self).__init__(*args, **kwargs) #what should 
i specify as a type?
   self.helper = FormHelper()
   self.helper.layout = Layout(
  Fieldset(
  'Edit data about your blog',
  Div('description', css_class="col-md-12"),
  ),
  ButtonHolder(
 Submit(css_class='btn-lg'), # not sure if this line is necessary 
for my purposes
 css_class="text-center"),
  )

Above, I am not sure what I should put in the place of "###INSERT_TYPE###" 
or whether the "Submit(css_class='btn-lg')" is necessary for me as I simply 
need to be able to "centre the text".

My model for the upload is as follows:

class Document(models.Model):
   docfile = models.FileField(upload_to='BAMfile')

And the HTML

{% load crispy_forms_tags %} at the top
{% crispy form %} inside form tags

I just need to know how I centre the text in the middle of my page... I 
can't believe that it could be this complicated

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/db89b078-b632-4b41-be14-8dddad6e9f08%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: crispy form styling of unconventional upload mechanism

2016-02-22 Thread James Schneider
On Feb 22, 2016 2:58 PM,  wrote:
>
> I have made an upload form button, that I need to be able to refers to
tin my css code such that I can centre it on the web page. However the
upload button is not constituted by any bootstrap like "btn" syntax, which
is prevalent in example code. Instead is constituted by the following code:
>
> #forms.py
>
> class DocumentForm(forms.Form):
> docfile = forms.FileField(label='Select a  BAM file')
>
> ### no class or model declared
>
> And so I have taken some example code that I have tried to adapt into to
my own code below and properly indented from the above code in forms.py.
>
> def __init__(self, *args, **kwargs):
>super(INSERT_TYPE, self).__init__(*args, **kwargs) #what
should i specify as a type?
>self.helper = FormHelper()
>self.helper.layout = Layout(
>   Fieldset(
>   'Edit data about your blog',
>   Div('description', css_class="col-md-12"),
>   ),
>   ButtonHolder(
>  Submit(css_class='btn-lg'), # not sure if this line is
necessary for my purposes
>  css_class="text-center"),
>   )
>
> Above, I am not sure what I should put in the place of
"###INSERT_TYPE###" or whether the "Submit(css_class='btn-lg')" is
necessary for me as I simply need to be able to "centre the text".
>
> My model for the upload is as follows:
>
> class Document(models.Model):
>docfile = models.FileField(upload_to='BAMfile')
>
> And the HTML
>
> {% load crispy_forms_tags %} at the top
> {% crispy form %} inside form tags
>
> I just need to know how I centre the text in the middle of my page... I
can't believe that it could be this complicated
>

Is this the only form where you have this requirement? If so, I wouldn't
even bother trying to muck with the built-in elements for crispy-forms.
Rather, just add an HTML() element to your Layout object instead using
Submit() that contains the desirable  tag (basically render the
button yourself manually).

The HTML() object is detailed on this page:
http://django-crispy-forms.readthedocs.org/en/latest/layouts.html#universal-layout-objects

You can provide extra CSS classes to Submit() to help with styling, but I
believe those are additive, and it sounds like the Bootstrap styling would
get in the way of what you're trying to do.

Otherwise your other option is to subclass the Submit() class and provide
your own rendering, but I would only go to that trouble if this button is
used in more than one location.

http://django-crispy-forms.readthedocs.org/en/latest/layouts.html#creating-your-own-layout-objects

-James

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2Be%2BciX7a2hhwwSgqpB18tCyaawAJfTaaddsH1GyE93Nv4DftA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: crispy form styling of unconventional upload mechanism

2016-02-22 Thread James Schneider
>
> I just need to know how I centre the text in the middle of my page... I
> can't believe that it could be this complicated
>

Another idea you can try is wrapping your ButtonHolder inside of a Div()
like Div(ButtonHolder(...), css_class='text-center') to center the whole
group, or just wrapping the Submit() itself.

-James

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2Be%2BciWe2EEk4EwcY1MgqHz1O7EwiiVQySkZ3NnWeubSJtrqvQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django authentication

2016-02-22 Thread James Schneider
On Mon, Feb 22, 2016 at 5:36 AM, Wilfreid Mpunia 
wrote:

> Good day, I have the following question.
> I'm still learning and improving my django level, but I'm a bite confused
> with a project that I'm working on.
>
> For a django web app, which requires a user to register with their email
> and password, I used the custom user and backend as shown the djangoproject
> website.
>
> However, later on I realised that  the app will have to make some api call
> with basic auth, which I assumes will be the registered user email and
> password.
>

When you say your app has to make some API calls, are these calls being
made outside of the user session (outside of the end-users browser)? API
calls within a users' browser generally make use of the existing user
session and SessionAuthentication and run as the same account as the
end-user is using. Is there something specific that you're doing that
requires basic auth (BA) on the web server?


>
> My questions is the following:
>  -  does it really make sense two have those two authentications? because
> I'm thinking to remove the django one, and rather use the
> django_rest_framework auth.
>
>
You can run everything using basic authentication, but most use session
authentication so that the API calls within a web page don't need their own
set of credentials, they simply piggy-back on the existing user session.

You may also run in to trouble trying to run both session authentication
and BA on the same server, since BA is handled by the web server directly
(before being passed to Django), and will try and protect every page of the
site without some extra custom configuration in your server configuration,
which may be acceptable, but usually there are at least some pages of a
site that are publicly available.

Honestly I would avoid BA if possible. This is backed up by the DRF
documentation stating that BA is really only suitable for testing:
http://www.django-rest-framework.org/api-guide/authentication/#basicauthentication

-James

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2Be%2BciVBjiRSU99Tk4M3aiA55ZQyL7Dw3Qzm3GqZraG0Vw6xiA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Accessing Request Object in Form Definition

2016-02-22 Thread Chris Kavanagh
I'm trying to understand how overriding the Constructor of a Form 
(forms.Form or model.Models) allows you to access the Request Object?  How 
does overriding __init__ allow one access to the Request?
I've looked at BaseForm and don't see the Request in the Constructor. So, I 
don't get it. I thought the Request Object could only be accessed in Views, 
basically. Any help is greatly appreciated, or a point in the right 
direction.

Ex:

class MyForm(forms.Form):

def __init__(self, request, *args, **kwargs):

self._my_request = request
super(MyForm, self).__init__(*args, **kwargs)



PS: It;s been years since I've used this group, if I've not posted the 
question, my apologies.




-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5e6430d8-f6ce-4a15-b2b4-0ecf7464e6b2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Installing MySQLdb for python2.7 in RHEL 6

2016-02-22 Thread Larry Martell
Not strictly a django question, but it's something required to get
django running.

I am trying to get django 1.9 running in RHEL 6. I have installed
python2.7 and when I try to install MySQLdb, I get the errors shown
below. I have googled and googled and tried many different things, all
with no success. Can anyone please let me know how I can get this
going?

# /usr/local/bin/pip2.7 install MySQL-python
Collecting MySQL-python
  Downloading MySQL-python-1.2.5.zip (108kB)
100% || 110kB 3.2MB/s
Installing collected packages: MySQL-python
  Running setup.py install for MySQL-python ... error
Complete output from command /usr/local/bin/python2.7 -u -c
"import setuptools,
tokenize;__file__='/tmp/pip-build-SPMNQU/MySQL-python/setup.py';exec(compile(getattr(tokenize,
'open', open)(__file__).read().replace('\r\n', '\n'), __file__,
'exec'))" install --record /tmp/pip-QrpP1S-record/install-record.txt
--single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
copying _mysql_exceptions.py -> build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/__init__.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/converters.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/connections.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/cursors.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/release.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/times.py -> build/lib.linux-x86_64-2.7/MySQLdb
creating build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/__init__.py ->
build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/CR.py ->
build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py ->
build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/ER.py ->
build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/FLAG.py ->
build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/REFRESH.py ->
build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py ->
build/lib.linux-x86_64-2.7/MySQLdb/constants
running build_ext
building '_mysql' extension
creating build/temp.linux-x86_64-2.7
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3
-Wall -Wstrict-prototypes -fPIC -Dversion_info=(1,2,5,'final',1)
-D__version__=1.2.5 -I/usr/include/mysql
-I/usr/local/include/python2.7 -c _mysql.c -o
build/temp.linux-x86_64-2.7/_mysql.o -g -pipe -Wp,-D_FORTIFY_SOURCE=2
-fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64
-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
-fno-strict-aliasing -fwrapv -fPIC -fPIC -g -static-libgcc
-fno-omit-frame-pointer -fno-strict-aliasing -DMY_PTHREAD_FASTMUTEX=1
_mysql.c:44:23: error: my_config.h: No such file or directory
_mysql.c:46:19: error: mysql.h: No such file or directory
_mysql.c:47:26: error: mysqld_error.h: No such file or directory
_mysql.c:48:20: error: errmsg.h: No such file or directory
_mysql.c:88: error: expected specifier-qualifier-list before ‘MYSQL’
_mysql.c:102: error: expected specifier-qualifier-list before ‘MYSQL_RES’
_mysql.c: In function ‘_mysql_Exception’:
_mysql.c:146: warning: implicit declaration of function ‘mysql_errno’
_mysql.c:146: error: ‘_mysql_ConnectionObject’ has no member named
‘connection’
_mysql.c:149: error: ‘CR_MAX_ERROR’ undeclared (first use in this function)
_mysql.c:149: error: (Each undeclared identifier is reported only once
_mysql.c:149: error: for each function it appears in.)
_mysql.c:161: error: ‘CR_COMMANDS_OUT_OF_SYNC’ undeclared (first
use in this function)
_mysql.c:162: error: ‘ER_DB_CREATE_EXISTS’ undeclared (first use
in this function)
_mysql.c:163: error: ‘ER_SYNTAX_ERROR’ undeclared (first use in
this function)
_mysql.c:164: error: ‘ER_PARSE_ERROR’ undeclared (first use in
this function)
_mysql.c:165: error: ‘ER_NO_SUCH_TABLE’ undeclared (first use in
this function)
_mysql.c:166: error: ‘ER_WRONG_DB_NAME’ undeclared (first use in
this function)
_mysql.c:167: error: ‘ER_WRONG_TABLE_NAME’ undeclared (first use
in this function)
_mysql.c:168: error: ‘ER_FIELD_SPECIFIED_TWICE’ undeclared (first
use in this function)
_mysql.c:169: error: ‘ER_INVALID_GROUP_FUNC_USE’ undeclared (first
use in this function)
_mysql.c:170: error: ‘ER_UNSUPPORTED_EXTENSION’ undeclared (first
use in this function)
_mysql.c:171: error: ‘ER_TABLE_MUST_HAVE_COLUMNS’ undeclared
(first use in this function)
_mysql.c:200: error: ‘ER_DUP_ENTRY’ undeclared (first use in this function)
_mysql.c:246: warning: implicit declaration of function ‘mysql_error’
_mysql.c:246: error: ‘_mysql_ConnectionObject’ has no member named
‘connection’
_mysql.c: In 

Re: Installing MySQLdb for python2.7 in RHEL 6

2016-02-22 Thread Kelvin Wong
Install the MariaDB/MySQL header files.

# yum install mysql-devel

or

# yum install MariaDB.devel

Depends on what fork you are planning on running

K



On Monday, February 22, 2016 at 6:17:58 PM UTC-8, larry@gmail.com wrote:
>
> Not strictly a django question, but it's something required to get 
> django running. 
>
> I am trying to get django 1.9 running in RHEL 6. I have installed 
> python2.7 and when I try to install MySQLdb, I get the errors shown 
> below. I have googled and googled and tried many different things, all 
> with no success. Can anyone please let me know how I can get this 
> going? 
>
> # /usr/local/bin/pip2.7 install MySQL-python 
> Collecting MySQL-python 
>   Downloading MySQL-python-1.2.5.zip (108kB) 
> 100% || 110kB 3.2MB/s 
> Installing collected packages: MySQL-python 
>   Running setup.py install for MySQL-python ... error 
> Complete output from command /usr/local/bin/python2.7 -u -c 
> "import setuptools, 
> tokenize;__file__='/tmp/pip-build-SPMNQU/MySQL-python/setup.py';exec(compile(getattr(tokenize,
>  
>
> 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 
> 'exec'))" install --record /tmp/pip-QrpP1S-record/install-record.txt 
> --single-version-externally-managed --compile: 
> running install 
> running build 
> running build_py 
> creating build 
> creating build/lib.linux-x86_64-2.7 
> copying _mysql_exceptions.py -> build/lib.linux-x86_64-2.7 
> creating build/lib.linux-x86_64-2.7/MySQLdb 
> copying MySQLdb/__init__.py -> build/lib.linux-x86_64-2.7/MySQLdb 
> copying MySQLdb/converters.py -> build/lib.linux-x86_64-2.7/MySQLdb 
> copying MySQLdb/connections.py -> build/lib.linux-x86_64-2.7/MySQLdb 
> copying MySQLdb/cursors.py -> build/lib.linux-x86_64-2.7/MySQLdb 
> copying MySQLdb/release.py -> build/lib.linux-x86_64-2.7/MySQLdb 
> copying MySQLdb/times.py -> build/lib.linux-x86_64-2.7/MySQLdb 
> creating build/lib.linux-x86_64-2.7/MySQLdb/constants 
> copying MySQLdb/constants/__init__.py -> 
> build/lib.linux-x86_64-2.7/MySQLdb/constants 
> copying MySQLdb/constants/CR.py -> 
> build/lib.linux-x86_64-2.7/MySQLdb/constants 
> copying MySQLdb/constants/FIELD_TYPE.py -> 
> build/lib.linux-x86_64-2.7/MySQLdb/constants 
> copying MySQLdb/constants/ER.py -> 
> build/lib.linux-x86_64-2.7/MySQLdb/constants 
> copying MySQLdb/constants/FLAG.py -> 
> build/lib.linux-x86_64-2.7/MySQLdb/constants 
> copying MySQLdb/constants/REFRESH.py -> 
> build/lib.linux-x86_64-2.7/MySQLdb/constants 
> copying MySQLdb/constants/CLIENT.py -> 
> build/lib.linux-x86_64-2.7/MySQLdb/constants 
> running build_ext 
> building '_mysql' extension 
> creating build/temp.linux-x86_64-2.7 
> gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 
> -Wall -Wstrict-prototypes -fPIC -Dversion_info=(1,2,5,'final',1) 
> -D__version__=1.2.5 -I/usr/include/mysql 
> -I/usr/local/include/python2.7 -c _mysql.c -o 
> build/temp.linux-x86_64-2.7/_mysql.o -g -pipe -Wp,-D_FORTIFY_SOURCE=2 
> -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 
> -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE 
> -fno-strict-aliasing -fwrapv -fPIC -fPIC -g -static-libgcc 
> -fno-omit-frame-pointer -fno-strict-aliasing -DMY_PTHREAD_FASTMUTEX=1 
> _mysql.c:44:23: error: my_config.h: No such file or directory 
> _mysql.c:46:19: error: mysql.h: No such file or directory 
> _mysql.c:47:26: error: mysqld_error.h: No such file or directory 
> _mysql.c:48:20: error: errmsg.h: No such file or directory 
> _mysql.c:88: error: expected specifier-qualifier-list before ‘MYSQL’ 
> _mysql.c:102: error: expected specifier-qualifier-list before 
> ‘MYSQL_RES’ 
> _mysql.c: In function ‘_mysql_Exception’: 
> _mysql.c:146: warning: implicit declaration of function ‘mysql_errno’ 
> _mysql.c:146: error: ‘_mysql_ConnectionObject’ has no member named 
> ‘connection’ 
> _mysql.c:149: error: ‘CR_MAX_ERROR’ undeclared (first use in this 
> function) 
> _mysql.c:149: error: (Each undeclared identifier is reported only once 
> _mysql.c:149: error: for each function it appears in.) 
> _mysql.c:161: error: ‘CR_COMMANDS_OUT_OF_SYNC’ undeclared (first 
> use in this function) 
> _mysql.c:162: error: ‘ER_DB_CREATE_EXISTS’ undeclared (first use 
> in this function) 
> _mysql.c:163: error: ‘ER_SYNTAX_ERROR’ undeclared (first use in 
> this function) 
> _mysql.c:164: error: ‘ER_PARSE_ERROR’ undeclared (first use in 
> this function) 
> _mysql.c:165: error: ‘ER_NO_SUCH_TABLE’ undeclared (first use in 
> this function) 
> _mysql.c:166: error: ‘ER_WRONG_DB_NAME’ undeclared (first use in 
> this function) 
> _mysql.c:167: error: ‘ER_WRONG_TABLE_NAME’ undeclared (first use 
> in this function) 
> _mysql.c:168: error: ‘ER_FIELD_SPECIFIED_TWICE’ undeclared (first 
> use in this function) 
> _mysql.c:169: er

Re: Installing MySQLdb for python2.7 in RHEL 6

2016-02-22 Thread Larry Martell
That failed:

# yum install mysql-devel
Loaded plugins: dellsysid, product-id, refresh-packagekit, security,
subscription-manager
Setting up Install Process
Package mysql-devel is obsoleted by mysql-community-devel, trying to
install mysql-community-devel-5.7.11-1.el6.x86_64 instead
Resolving Dependencies
--> Running transaction check
---> Package mysql-community-devel.x86_64 0:5.7.11-1.el6 will be installed
--> Processing Dependency: mysql-community-libs(x86-64) = 5.7.11-1.el6
for package: mysql-community-devel-5.7.11-1.el6.x86_64
--> Processing Dependency: libmysqlclient.so.20()(64bit) for package:
mysql-community-devel-5.7.11-1.el6.x86_64
--> Running transaction check
---> Package mysql-community-libs.x86_64 0:5.7.11-1.el6 will be obsoleting
--> Processing Dependency: mysql-community-common(x86-64) =
5.7.11-1.el6 for package: mysql-community-libs-5.7.11-1.el6.x86_64
---> Package mysql-libs.x86_64 0:5.5.44-1.el6.remi will be obsoleted
--> Processing Dependency: libmysqlclient.so.18()(64bit) for package:
php-mysql-5.4.43-1.el6.remi.x86_64
--> Processing Dependency:
libmysqlclient.so.18(libmysqlclient_16)(64bit) for package:
php-mysql-5.4.43-1.el6.remi.x86_64
--> Processing Dependency:
libmysqlclient.so.18(libmysqlclient_18)(64bit) for package:
php-mysql-5.4.43-1.el6.remi.x86_64
--> Processing Dependency: real-mysql-libs(x86-64) = 5.5.44-1.el6.remi
for package: mysql-server-5.5.44-1.el6.remi.x86_64
--> Processing Dependency: real-mysql-libs(x86-64) = 5.5.44-1.el6.remi
for package: mysql-5.5.44-1.el6.remi.x86_64
--> Running transaction check
---> Package mysql.x86_64 0:5.5.44-1.el6.remi will be obsoleted
---> Package mysql-community-client.x86_64 0:5.7.11-1.el6 will be obsoleting
---> Package mysql-community-common.x86_64 0:5.7.11-1.el6 will be installed
---> Package mysql-community-server.x86_64 0:5.7.11-1.el6 will be obsoleting
---> Package mysql-libs.x86_64 0:5.5.44-1.el6.remi will be obsoleted
--> Processing Dependency: libmysqlclient.so.18()(64bit) for package:
php-mysql-5.4.43-1.el6.remi.x86_64
--> Processing Dependency:
libmysqlclient.so.18(libmysqlclient_16)(64bit) for package:
php-mysql-5.4.43-1.el6.remi.x86_64
--> Processing Dependency:
libmysqlclient.so.18(libmysqlclient_18)(64bit) for package:
php-mysql-5.4.43-1.el6.remi.x86_64
---> Package mysql-server.x86_64 0:5.5.44-1.el6.remi will be obsoleted
--> Finished Dependency Resolution
Error: Package: php-mysql-5.4.43-1.el6.remi.x86_64 (@remi)
   Requires: libmysqlclient.so.18(libmysqlclient_16)(64bit)
   Removing: mysql-libs-5.5.44-1.el6.remi.x86_64 (@remi)
   libmysqlclient.so.18(libmysqlclient_16)(64bit)
   Obsoleted By: mysql-community-libs-5.7.11-1.el6.x86_64
(mysql57-community)
   Not found
Error: Package: php-mysql-5.4.43-1.el6.remi.x86_64 (@remi)
   Requires: libmysqlclient.so.18()(64bit)
   Removing: mysql-libs-5.5.44-1.el6.remi.x86_64 (@remi)
   libmysqlclient.so.18()(64bit)
   Obsoleted By: mysql-community-libs-5.7.11-1.el6.x86_64
(mysql57-community)
   Not found
Error: Package: php-mysql-5.4.43-1.el6.remi.x86_64 (@remi)
   Requires: libmysqlclient.so.18(libmysqlclient_18)(64bit)
   Removing: mysql-libs-5.5.44-1.el6.remi.x86_64 (@remi)
   libmysqlclient.so.18(libmysqlclient_18)(64bit)
   Obsoleted By: mysql-community-libs-5.7.11-1.el6.x86_64
(mysql57-community)
   Not found
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest


On Mon, Feb 22, 2016 at 10:07 PM, Kelvin Wong  wrote:
> Install the MariaDB/MySQL header files.
>
> # yum install mysql-devel
>
> or
>
> # yum install MariaDB.devel
>
> Depends on what fork you are planning on running
>
> K
>
>
>
>
> On Monday, February 22, 2016 at 6:17:58 PM UTC-8, larry@gmail.com wrote:
>>
>> Not strictly a django question, but it's something required to get
>> django running.
>>
>> I am trying to get django 1.9 running in RHEL 6. I have installed
>> python2.7 and when I try to install MySQLdb, I get the errors shown
>> below. I have googled and googled and tried many different things, all
>> with no success. Can anyone please let me know how I can get this
>> going?
>>
>> # /usr/local/bin/pip2.7 install MySQL-python
>> Collecting MySQL-python
>>   Downloading MySQL-python-1.2.5.zip (108kB)
>> 100% || 110kB 3.2MB/s
>> Installing collected packages: MySQL-python
>>   Running setup.py install for MySQL-python ... error
>> Complete output from command /usr/local/bin/python2.7 -u -c
>> "import setuptools,
>>
>> tokenize;__file__='/tmp/pip-build-SPMNQU/MySQL-python/setup.py';exec(compile(getattr(tokenize,
>> 'open', open)(__file__).read().replace('\r\n', '\n'), __file__,
>> 'exec'))" install --record /tmp/pip-QrpP1S-record/install-record.txt
>> --single-version-externally-managed --compile:
>> running install
>> running build
>> running build_p

Re: Installing MySQLdb for python2.7 in RHEL 6

2016-02-22 Thread Kelvin Wong
You need to locate the header files in order for that to compile.

You might want to see if they are located somewhere on your system by using 
'find' or else check 'yum list installed' to see if you have already 
installed the mysql devel package for your version of the database server 
(i'm guessing that you haven't got the headers).

If you haven't got them on your machine then you have to install them.

K

On Monday, February 22, 2016 at 7:10:34 PM UTC-8, larry@gmail.com wrote:
>
> That failed: 
>
> # yum install mysql-devel 
> Loaded plugins: dellsysid, product-id, refresh-packagekit, security, 
> subscription-manager 
> Setting up Install Process 
> Package mysql-devel is obsoleted by mysql-community-devel, trying to 
> install mysql-community-devel-5.7.11-1.el6.x86_64 instead 
> Resolving Dependencies 
> --> Running transaction check 
> ---> Package mysql-community-devel.x86_64 0:5.7.11-1.el6 will be installed 
> --> Processing Dependency: mysql-community-libs(x86-64) = 5.7.11-1.el6 
> for package: mysql-community-devel-5.7.11-1.el6.x86_64 
> --> Processing Dependency: libmysqlclient.so.20()(64bit) for package: 
> mysql-community-devel-5.7.11-1.el6.x86_64 
> --> Running transaction check 
> ---> Package mysql-community-libs.x86_64 0:5.7.11-1.el6 will be obsoleting 
> --> Processing Dependency: mysql-community-common(x86-64) = 
> 5.7.11-1.el6 for package: mysql-community-libs-5.7.11-1.el6.x86_64 
> ---> Package mysql-libs.x86_64 0:5.5.44-1.el6.remi will be obsoleted 
> --> Processing Dependency: libmysqlclient.so.18()(64bit) for package: 
> php-mysql-5.4.43-1.el6.remi.x86_64 
> --> Processing Dependency: 
> libmysqlclient.so.18(libmysqlclient_16)(64bit) for package: 
> php-mysql-5.4.43-1.el6.remi.x86_64 
> --> Processing Dependency: 
> libmysqlclient.so.18(libmysqlclient_18)(64bit) for package: 
> php-mysql-5.4.43-1.el6.remi.x86_64 
> --> Processing Dependency: real-mysql-libs(x86-64) = 5.5.44-1.el6.remi 
> for package: mysql-server-5.5.44-1.el6.remi.x86_64 
> --> Processing Dependency: real-mysql-libs(x86-64) = 5.5.44-1.el6.remi 
> for package: mysql-5.5.44-1.el6.remi.x86_64 
> --> Running transaction check 
> ---> Package mysql.x86_64 0:5.5.44-1.el6.remi will be obsoleted 
> ---> Package mysql-community-client.x86_64 0:5.7.11-1.el6 will be 
> obsoleting 
> ---> Package mysql-community-common.x86_64 0:5.7.11-1.el6 will be 
> installed 
> ---> Package mysql-community-server.x86_64 0:5.7.11-1.el6 will be 
> obsoleting 
> ---> Package mysql-libs.x86_64 0:5.5.44-1.el6.remi will be obsoleted 
> --> Processing Dependency: libmysqlclient.so.18()(64bit) for package: 
> php-mysql-5.4.43-1.el6.remi.x86_64 
> --> Processing Dependency: 
> libmysqlclient.so.18(libmysqlclient_16)(64bit) for package: 
> php-mysql-5.4.43-1.el6.remi.x86_64 
> --> Processing Dependency: 
> libmysqlclient.so.18(libmysqlclient_18)(64bit) for package: 
> php-mysql-5.4.43-1.el6.remi.x86_64 
> ---> Package mysql-server.x86_64 0:5.5.44-1.el6.remi will be obsoleted 
> --> Finished Dependency Resolution 
> Error: Package: php-mysql-5.4.43-1.el6.remi.x86_64 (@remi) 
>Requires: libmysqlclient.so.18(libmysqlclient_16)(64bit) 
>Removing: mysql-libs-5.5.44-1.el6.remi.x86_64 (@remi) 
>libmysqlclient.so.18(libmysqlclient_16)(64bit) 
>Obsoleted By: mysql-community-libs-5.7.11-1.el6.x86_64 
> (mysql57-community) 
>Not found 
> Error: Package: php-mysql-5.4.43-1.el6.remi.x86_64 (@remi) 
>Requires: libmysqlclient.so.18()(64bit) 
>Removing: mysql-libs-5.5.44-1.el6.remi.x86_64 (@remi) 
>libmysqlclient.so.18()(64bit) 
>Obsoleted By: mysql-community-libs-5.7.11-1.el6.x86_64 
> (mysql57-community) 
>Not found 
> Error: Package: php-mysql-5.4.43-1.el6.remi.x86_64 (@remi) 
>Requires: libmysqlclient.so.18(libmysqlclient_18)(64bit) 
>Removing: mysql-libs-5.5.44-1.el6.remi.x86_64 (@remi) 
>libmysqlclient.so.18(libmysqlclient_18)(64bit) 
>Obsoleted By: mysql-community-libs-5.7.11-1.el6.x86_64 
> (mysql57-community) 
>Not found 
>  You could try using --skip-broken to work around the problem 
>  You could try running: rpm -Va --nofiles --nodigest 
>
>
> On Mon, Feb 22, 2016 at 10:07 PM, Kelvin Wong  > wrote: 
> > Install the MariaDB/MySQL header files. 
> > 
> > # yum install mysql-devel 
> > 
> > or 
> > 
> > # yum install MariaDB.devel 
> > 
> > Depends on what fork you are planning on running 
> > 
> > K 
> > 
> > 
> > 
> > 
> > On Monday, February 22, 2016 at 6:17:58 PM UTC-8, larry@gmail.com 
> wrote: 
> >> 
> >> Not strictly a django question, but it's something required to get 
> >> django running. 
> >> 
> >> I am trying to get django 1.9 running in RHEL 6. I have installed 
> >> python2.7 and when I try to install MySQLdb, I get the errors shown 
> >> below. I have googled and googled and tried many different things, all 
> >> with no success. Ca

Re: Installing MySQLdb for python2.7 in RHEL 6

2016-02-22 Thread Larry Martell
Not really sure what I am looking for or what to do.

# yum list installed | grep mysql
compat-mysql51.x86_64   5.1.54-1.el6.remi   @remi
mysql.x86_645.5.44-1.el6.remi   @remi
mysql-libs.x86_64   5.5.44-1.el6.remi   @remi
mysql-server.x86_64 5.5.44-1.el6.remi   @remi
mysql57-community-release.noarchel6-7
@/mysql57-community-release-el6-7.noarch
php-mysql.x86_645.4.43-1.el6.remi   @remi

I don't see the devel package, but when I try to install it it fails
as shown below.

On Mon, Feb 22, 2016 at 10:20 PM, Kelvin Wong  wrote:
> You need to locate the header files in order for that to compile.
>
> You might want to see if they are located somewhere on your system by using
> 'find' or else check 'yum list installed' to see if you have already
> installed the mysql devel package for your version of the database server
> (i'm guessing that you haven't got the headers).
>
> If you haven't got them on your machine then you have to install them.
>
> K
>
> On Monday, February 22, 2016 at 7:10:34 PM UTC-8, larry@gmail.com wrote:
>>
>> That failed:
>>
>> # yum install mysql-devel
>> Loaded plugins: dellsysid, product-id, refresh-packagekit, security,
>> subscription-manager
>> Setting up Install Process
>> Package mysql-devel is obsoleted by mysql-community-devel, trying to
>> install mysql-community-devel-5.7.11-1.el6.x86_64 instead
>> Resolving Dependencies
>> --> Running transaction check
>> ---> Package mysql-community-devel.x86_64 0:5.7.11-1.el6 will be installed
>> --> Processing Dependency: mysql-community-libs(x86-64) = 5.7.11-1.el6
>> for package: mysql-community-devel-5.7.11-1.el6.x86_64
>> --> Processing Dependency: libmysqlclient.so.20()(64bit) for package:
>> mysql-community-devel-5.7.11-1.el6.x86_64
>> --> Running transaction check
>> ---> Package mysql-community-libs.x86_64 0:5.7.11-1.el6 will be obsoleting
>> --> Processing Dependency: mysql-community-common(x86-64) =
>> 5.7.11-1.el6 for package: mysql-community-libs-5.7.11-1.el6.x86_64
>> ---> Package mysql-libs.x86_64 0:5.5.44-1.el6.remi will be obsoleted
>> --> Processing Dependency: libmysqlclient.so.18()(64bit) for package:
>> php-mysql-5.4.43-1.el6.remi.x86_64
>> --> Processing Dependency:
>> libmysqlclient.so.18(libmysqlclient_16)(64bit) for package:
>> php-mysql-5.4.43-1.el6.remi.x86_64
>> --> Processing Dependency:
>> libmysqlclient.so.18(libmysqlclient_18)(64bit) for package:
>> php-mysql-5.4.43-1.el6.remi.x86_64
>> --> Processing Dependency: real-mysql-libs(x86-64) = 5.5.44-1.el6.remi
>> for package: mysql-server-5.5.44-1.el6.remi.x86_64
>> --> Processing Dependency: real-mysql-libs(x86-64) = 5.5.44-1.el6.remi
>> for package: mysql-5.5.44-1.el6.remi.x86_64
>> --> Running transaction check
>> ---> Package mysql.x86_64 0:5.5.44-1.el6.remi will be obsoleted
>> ---> Package mysql-community-client.x86_64 0:5.7.11-1.el6 will be
>> obsoleting
>> ---> Package mysql-community-common.x86_64 0:5.7.11-1.el6 will be
>> installed
>> ---> Package mysql-community-server.x86_64 0:5.7.11-1.el6 will be
>> obsoleting
>> ---> Package mysql-libs.x86_64 0:5.5.44-1.el6.remi will be obsoleted
>> --> Processing Dependency: libmysqlclient.so.18()(64bit) for package:
>> php-mysql-5.4.43-1.el6.remi.x86_64
>> --> Processing Dependency:
>> libmysqlclient.so.18(libmysqlclient_16)(64bit) for package:
>> php-mysql-5.4.43-1.el6.remi.x86_64
>> --> Processing Dependency:
>> libmysqlclient.so.18(libmysqlclient_18)(64bit) for package:
>> php-mysql-5.4.43-1.el6.remi.x86_64
>> ---> Package mysql-server.x86_64 0:5.5.44-1.el6.remi will be obsoleted
>> --> Finished Dependency Resolution
>> Error: Package: php-mysql-5.4.43-1.el6.remi.x86_64 (@remi)
>>Requires: libmysqlclient.so.18(libmysqlclient_16)(64bit)
>>Removing: mysql-libs-5.5.44-1.el6.remi.x86_64 (@remi)
>>libmysqlclient.so.18(libmysqlclient_16)(64bit)
>>Obsoleted By: mysql-community-libs-5.7.11-1.el6.x86_64
>> (mysql57-community)
>>Not found
>> Error: Package: php-mysql-5.4.43-1.el6.remi.x86_64 (@remi)
>>Requires: libmysqlclient.so.18()(64bit)
>>Removing: mysql-libs-5.5.44-1.el6.remi.x86_64 (@remi)
>>libmysqlclient.so.18()(64bit)
>>Obsoleted By: mysql-community-libs-5.7.11-1.el6.x86_64
>> (mysql57-community)
>>Not found
>> Error: Package: php-mysql-5.4.43-1.el6.remi.x86_64 (@remi)
>>Requires: libmysqlclient.so.18(libmysqlclient_18)(64bit)
>>Removing: mysql-libs-5.5.44-1.el6.remi.x86_64 (@remi)
>>libmysqlclient.so.18(libmysqlclient_18)(64bit)
>>Obsoleted By: mysql-community-libs-5.7.11-1.el6.x86_64
>> (mysql57-community)
>>Not found
>>  You could try using --skip-broken to work around the problem
>>  You could try running: rpm -Va --nofiles --nodigest
>>
>>
>> On Mon, Feb 22, 2016 at 10:07 PM, Kelvin Wong  wrote:
>> > Install the Mari

Re: Accessing Request Object in Form Definition

2016-02-22 Thread Chris Kavanagh
To possibly answer my own question, thinking out loud, we have to override 
the Form Constructor so we can pass in the Request from the view when 
instantiating the Form?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/db26c4d0-edd0-4e0e-8af1-257627a6b0b1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Accessing Request Object in Form Definition

2016-02-22 Thread James Schneider
On Mon, Feb 22, 2016 at 10:23 PM, Chris Kavanagh  wrote:

> To possibly answer my own question, thinking out loud, we have to override
> the Form Constructor so we can pass in the Request from the view when
> instantiating the Form?
>

You beat me to it. Yes, you would need to override __init__() to include
the request in to your form class. Be sure to keep it out of your
args/kwargs that are passed on to your super() call, though, as it will
confuse the parent form class (if I remember correctly when I did the same
thing). If you are using CBV's, that you'll need to override get_form() as
well in order to return the form with the self.request as one of the
arguments being passed in.

-James

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2Be%2BciWRm5muqDY75_tCh%2BfroAsT70iAYW%2BCVL__aPAtVoQ4wg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Installing MySQLdb for python2.7 in RHEL 6

2016-02-22 Thread Kelvin Wong
You are mixing the repos (remi and the regular redhat one). You should 
decide which one you want to use for mysql and stick to it.

The remi repo has the devel package available

http://rpms.famillecollet.com/enterprise/6/remi/x86_64/repoview/applications.databases.group.html

You can isolate a repo to see what it offers

$ yum --disablerepo "*" --enablerepo "remi" list available 

K


On Monday, February 22, 2016 at 7:37:43 PM UTC-8, larry@gmail.com wrote:
>
> Not really sure what I am looking for or what to do. 
>
> # yum list installed | grep mysql 
> compat-mysql51.x86_64   5.1.54-1.el6.remi   @remi 
> mysql.x86_645.5.44-1.el6.remi   @remi 
> mysql-libs.x86_64   5.5.44-1.el6.remi   @remi 
> mysql-server.x86_64 5.5.44-1.el6.remi   @remi 
> mysql57-community-release.noarchel6-7 
> @/mysql57-community-release-el6-7.noarch 
> php-mysql.x86_645.4.43-1.el6.remi   @remi 
>
> I don't see the devel package, but when I try to install it it fails 
> as shown below. 
>
> On Mon, Feb 22, 2016 at 10:20 PM, Kelvin Wong  > wrote: 
> > You need to locate the header files in order for that to compile. 
> > 
> > You might want to see if they are located somewhere on your system by 
> using 
> > 'find' or else check 'yum list installed' to see if you have already 
> > installed the mysql devel package for your version of the database 
> server 
> > (i'm guessing that you haven't got the headers). 
> > 
> > If you haven't got them on your machine then you have to install them. 
> > 
> > K 
> > 
> > On Monday, February 22, 2016 at 7:10:34 PM UTC-8, larry@gmail.com 
> wrote: 
> >> 
> >> That failed: 
> >> 
> >> # yum install mysql-devel 
> >> Loaded plugins: dellsysid, product-id, refresh-packagekit, security, 
> >> subscription-manager 
> >> Setting up Install Process 
> >> Package mysql-devel is obsoleted by mysql-community-devel, trying to 
> >> install mysql-community-devel-5.7.11-1.el6.x86_64 instead 
> >> Resolving Dependencies 
> >> --> Running transaction check 
> >> ---> Package mysql-community-devel.x86_64 0:5.7.11-1.el6 will be 
> installed 
> >> --> Processing Dependency: mysql-community-libs(x86-64) = 5.7.11-1.el6 
> >> for package: mysql-community-devel-5.7.11-1.el6.x86_64 
> >> --> Processing Dependency: libmysqlclient.so.20()(64bit) for package: 
> >> mysql-community-devel-5.7.11-1.el6.x86_64 
> >> --> Running transaction check 
> >> ---> Package mysql-community-libs.x86_64 0:5.7.11-1.el6 will be 
> obsoleting 
> >> --> Processing Dependency: mysql-community-common(x86-64) = 
> >> 5.7.11-1.el6 for package: mysql-community-libs-5.7.11-1.el6.x86_64 
> >> ---> Package mysql-libs.x86_64 0:5.5.44-1.el6.remi will be obsoleted 
> >> --> Processing Dependency: libmysqlclient.so.18()(64bit) for package: 
> >> php-mysql-5.4.43-1.el6.remi.x86_64 
> >> --> Processing Dependency: 
> >> libmysqlclient.so.18(libmysqlclient_16)(64bit) for package: 
> >> php-mysql-5.4.43-1.el6.remi.x86_64 
> >> --> Processing Dependency: 
> >> libmysqlclient.so.18(libmysqlclient_18)(64bit) for package: 
> >> php-mysql-5.4.43-1.el6.remi.x86_64 
> >> --> Processing Dependency: real-mysql-libs(x86-64) = 5.5.44-1.el6.remi 
> >> for package: mysql-server-5.5.44-1.el6.remi.x86_64 
> >> --> Processing Dependency: real-mysql-libs(x86-64) = 5.5.44-1.el6.remi 
> >> for package: mysql-5.5.44-1.el6.remi.x86_64 
> >> --> Running transaction check 
> >> ---> Package mysql.x86_64 0:5.5.44-1.el6.remi will be obsoleted 
> >> ---> Package mysql-community-client.x86_64 0:5.7.11-1.el6 will be 
> >> obsoleting 
> >> ---> Package mysql-community-common.x86_64 0:5.7.11-1.el6 will be 
> >> installed 
> >> ---> Package mysql-community-server.x86_64 0:5.7.11-1.el6 will be 
> >> obsoleting 
> >> ---> Package mysql-libs.x86_64 0:5.5.44-1.el6.remi will be obsoleted 
> >> --> Processing Dependency: libmysqlclient.so.18()(64bit) for package: 
> >> php-mysql-5.4.43-1.el6.remi.x86_64 
> >> --> Processing Dependency: 
> >> libmysqlclient.so.18(libmysqlclient_16)(64bit) for package: 
> >> php-mysql-5.4.43-1.el6.remi.x86_64 
> >> --> Processing Dependency: 
> >> libmysqlclient.so.18(libmysqlclient_18)(64bit) for package: 
> >> php-mysql-5.4.43-1.el6.remi.x86_64 
> >> ---> Package mysql-server.x86_64 0:5.5.44-1.el6.remi will be obsoleted 
> >> --> Finished Dependency Resolution 
> >> Error: Package: php-mysql-5.4.43-1.el6.remi.x86_64 (@remi) 
> >>Requires: libmysqlclient.so.18(libmysqlclient_16)(64bit) 
> >>Removing: mysql-libs-5.5.44-1.el6.remi.x86_64 (@remi) 
> >>libmysqlclient.so.18(libmysqlclient_16)(64bit) 
> >>Obsoleted By: mysql-community-libs-5.7.11-1.el6.x86_64 
> >> (mysql57-community) 
> >>Not found 
> >> Error: Package: php-mysql-5.4.43-1.el6.remi.x86_64 (@remi) 
> >>Requires: libmysqlclient.so.18()(64bit) 
> >>Removing: mysql-libs-5.5.44-1.el6.remi.x86_64 (@remi) 
> >>