Re: Access denied for MySQL user in Django

2016-01-17 Thread Sergiy Khohlov
Using password no. Have you set notempty password with creating table
permission?
15 січ. 2016 18:20 "Galil"  пише:

> Hi Fred,
>
> The user cdraccess is not the root user and it does not have the rights to
> access table 'user'. I deleted the guest user as root but nothing changes.
> The problem was not fixed.
>
> On Thursday, 14 January 2016 17:50:21 UTC, Fred Stluka wrote:
>>
>> Galil,
>>
>> I had a problem like this a couple years ago, and the solution
>> was to delete the anonymous MySQL guest user as:
>>
>> mysql> use mysql;
>> mysql> delete from user where host='localhost' and 'user='';
>> mysql> flush privileges;
>>
>> I'm not sure why Django 1.4 was trying to connect as the guest
>> user when it had a username and password that it was
>> supposed to be using, but for some reason it was.  Deleting
>> the guest user from MySQL fixed it for me, and is a good idea
>> for security reasons anyhow.
>>
>> --Fred
>> --
>> Fred Stluka -- mailt...@bristle.com -- http://bristle.com/~fred/
>> Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
>> Open Source: Without walls and fences, we need no Windows or Gates.
>> --
>> On 1/14/16 7:11 AM, Galil wrote:
>>
>> I have created a Django app and which uses MySQL. The settings.py file in
>> the database sections is:
>>
>> DATABASES = {
>> 'cdraccess': {
>> 'ENGINE': 'django.db.backends.mysql',
>> 'NAME': os.environ.get('CDR_DB_NAME', 'portal2'),
>> 'USER': os.environ.get('CDR_DB_USER', 'cdraccess'),
>> 'HOST': os.environ.get('CDR_DB_HOST', '127.0.0.1'),
>> 'CONN_MAX_AGE': 0,
>> 'PASSWORD': os.environ.get('CDR_DB_PASSWORD', ''),
>> },
>> 'default': {
>> 'ENGINE': 'django.db.backends.sqlite3',
>> 'NAME': 'db.sqlite3',
>> }}
>>
>> I run the app like:
>>
>> CDR_DB_PASSWORD='password' CDR_DB_HOST='host_name' ./manage.py runserver
>>
>> but I get the following error:
>>
>> Access denied for user 'cdraccess'@'host_ip_here' (using password: NO)")
>>
>> I tried to access the database from terminal, like:
>>
>>$ mysql --host=[host_name] --user=cdraccess -p portal2
>>
>> and worked fine.
>>
>> What is going wrong in here? And what does this "(using password: NO)"
>> mean?
>>
>> --
>> 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/e1c26a0d-a509-46eb-b496-f7f09161e606%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/fa3b7acf-e015-4e0c-abbe-49da80b752a9%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/CADTRxJNBV29q6XBTjSK0haKpVNhNe%3Dj5BtUxCmgL%2BwtrAOvEsQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


please help me !django admin search bar add placeholder variable and how to call it in modelAdmin! HELP!

2016-01-17 Thread superzhang16
I want to add placeholder to search bar .First,I override the template 
change_list.html and find the search bar ,I know add attribute 
placeholder ,and I defined a variable placeholder={{'''search_tip'}}
to placeholder, as my app has three searchbar in different modelAdmin, I 
want to change the context of the placeholder by changing the variable..but 
I don't konw how to call the variable 'search_tip''  in the modelAdmin!

-- 
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/90ee2d01-4482-4066-bedd-ff1bfce92e07%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


date picker

2016-01-17 Thread sum abiut
Hi,
i am having some trouble with my date picker. I probably missing someting,
the form fields are displaying fine, but some how the datepicker is no
displaying. probably something to do with my jquery. Please help

models.py
class foreginexchange(models.Model):
Sold_deal_number=models.CharField(max_length=45)
Value_date=models.DateField()
Vatu_equivalent=models.CharField(max_length=45)
Instructions=models.TextField()
Done_Date=models.DateField()
Booked=(
('Tonny Garae','Tonny Garae'),
('Fredric Jacob','Fredric Jacob'),
)
Worked_By=models.CharField(max_length=45,choices=Worked)

def __unicode__(self):
return self.Sold_deal_number


form.py

from django import forms

from foregin_exchange.models import foreginexchange

class foregin_exchange_form(forms.ModelForm):
class Meta:
model =foreginexchange
widgets = {'Value_date':
forms.DateInput(attrs={'class':'datepicker'}),}
widgets={'Done_Date':forms.DateInput(attrs={'class':'datepicker'}),}


template.html



  




   
  jQuery UI Datepicker - Default functionality
  
  
  
  
  
  $(function() {
$( "#datepicker" ).datepicker();
  });
  

  

  

  

  {%extends "loginpage.html"%}


 {%block content%}
  Add New Foregin Exchange Data

  

{%csrf_token%}

{{form.as_table}}






  

  {%endblock%}


  


-- 
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/CAPCf-y6Qh4EhFUD-opsNj-Wqp1N7SEBZD%3D4ygicC-6koYmKELQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Using web2py DAL in Django

2016-01-17 Thread Abhijit Chatterjee
Does anyone know how to use DAL (database abstraction layer) that web2py 
uses in Django?

https://docs.djangoproject.com/en/1.9/intro/overview/

This comes out of django site:

"For that matter, you don’t have to use Django’s database API, either. You 
can use another database abstraction layer, you can read XML files, you can 
read files off disk, or anything you want. Each piece of Django – models, 
views, templates – is decoupled from the next."


-- 
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/dbe6a49d-10c0-4328-a4fd-684fb0117fda%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django 1.9 ./manage.py migrate error

2016-01-17 Thread Marisa DeMeglio
Ok I had to run these commands to make it work:

$manage.py makemigrations  
$migrate --fake-initial.

(for reference: django 1.9.1 / sqlite / OSX / python 3.4)

On Sunday, January 17, 2016 at 9:48:22 AM UTC-8, Marisa DeMeglio wrote:
>
> Did you ever figure this out? I just upgraded from Django 1.8 to 1.9 and 
> I'm having the same issue.
>
> On Saturday, December 12, 2015 at 10:01:39 PM UTC-8, Xuton Ion wrote:
>>
>> Thanks for the assistance so far.
>>
>> Reading https://docs.djangoproject.com/en/1.9/topics/migrations/ it says 
>> I should be able to run migrate to apply migrations.
>> But does this mean I have to manually do something, or should that work 
>> the same as it did on 1.8?
>>
>> I am assuming that it should also be able to create the database from the 
>> model with just running that one command.
>>
>> When creating a new project the migrate line runs fine, so it seems to be 
>> something specific to the project. I cant share the project though
>>
>> On Saturday, 12 December 2015 19:14:55 UTC+2, Tim Graham wrote:
>>>
>>> Is there a reason you can't use migrations? --run-syncdb is really only 
>>> meant for huge projects (hundreds or thousands of models) where migrations 
>>> are too slow. Not sure why it's not working though. You'd have to project a 
>>> sample project for me to debug further.
>>>
>>> On Saturday, December 12, 2015 at 11:53:37 AM UTC-5, Xuton Ion wrote:

 No, I haven't added any migrations. 

 I did try with --run-syncdb though, and still had the same error though

 On Saturday, 12 December 2015 16:26:15 UTC+2, Tim Graham wrote:
>
> Does your application have migrations? Quoting the 1.9 release notes, 
> "Automatic syncing of apps without migrations is removed. Migrations are 
> compulsory for all apps unless you pass the --run-syncdb 
> 
>  
> option to migrate."
>
> On Saturday, December 12, 2015 at 8:42:58 AM UTC-5, Xuton Ion wrote:
>>
>> Hi
>>
>> I seem to have an issue with running migrate and have been googling 
>> all day without any luck
>>
>> I have an app which works and runs on 1.8
>> After cloning the repo and creating a new ve, I ended up with Django 
>> 1.9
>>
>> Running the ./manage.py migrate creates the database, but none of the 
>> tables from the model. It returns
>> django.db.utils.OperationalError: no such table: table_name
>>
>> If I delete the db.sqlite3 (still in dev so not postgress yet), 
>> deactivate my ve and use my ve with django 1.8, the migrate line runs 
>> fine. 
>> If I then re-activate my ve with 1.9, everything works fine. I can 
>> make changes and run makemigrations, and it works. But the initial state 
>> seems to not work
>>
>> Anyone else have the same issue, or have some advice for 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/31161ef7-6b4b-44de-84bd-a5dc336c087c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django 1.9 ./manage.py migrate error

2016-01-17 Thread Marisa DeMeglio
Did you ever figure this out? I just upgraded from Django 1.8 to 1.9 and 
I'm having the same issue.

On Saturday, December 12, 2015 at 10:01:39 PM UTC-8, Xuton Ion wrote:
>
> Thanks for the assistance so far.
>
> Reading https://docs.djangoproject.com/en/1.9/topics/migrations/ it says 
> I should be able to run migrate to apply migrations.
> But does this mean I have to manually do something, or should that work 
> the same as it did on 1.8?
>
> I am assuming that it should also be able to create the database from the 
> model with just running that one command.
>
> When creating a new project the migrate line runs fine, so it seems to be 
> something specific to the project. I cant share the project though
>
> On Saturday, 12 December 2015 19:14:55 UTC+2, Tim Graham wrote:
>>
>> Is there a reason you can't use migrations? --run-syncdb is really only 
>> meant for huge projects (hundreds or thousands of models) where migrations 
>> are too slow. Not sure why it's not working though. You'd have to project a 
>> sample project for me to debug further.
>>
>> On Saturday, December 12, 2015 at 11:53:37 AM UTC-5, Xuton Ion wrote:
>>>
>>> No, I haven't added any migrations. 
>>>
>>> I did try with --run-syncdb though, and still had the same error though
>>>
>>> On Saturday, 12 December 2015 16:26:15 UTC+2, Tim Graham wrote:

 Does your application have migrations? Quoting the 1.9 release notes, 
 "Automatic syncing of apps without migrations is removed. Migrations are 
 compulsory for all apps unless you pass the --run-syncdb 
 
  
 option to migrate."

 On Saturday, December 12, 2015 at 8:42:58 AM UTC-5, Xuton Ion wrote:
>
> Hi
>
> I seem to have an issue with running migrate and have been googling 
> all day without any luck
>
> I have an app which works and runs on 1.8
> After cloning the repo and creating a new ve, I ended up with Django 
> 1.9
>
> Running the ./manage.py migrate creates the database, but none of the 
> tables from the model. It returns
> django.db.utils.OperationalError: no such table: table_name
>
> If I delete the db.sqlite3 (still in dev so not postgress yet), 
> deactivate my ve and use my ve with django 1.8, the migrate line runs 
> fine. 
> If I then re-activate my ve with 1.9, everything works fine. I can 
> make changes and run makemigrations, and it works. But the initial state 
> seems to not work
>
> Anyone else have the same issue, or have some advice for 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/f6542826-440b-403e-97ab-20aad82b1009%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


is there a util.py to automate renaming a Django app?

2016-01-17 Thread MW
Hi,

I want to rename a Django app.

Google search shows it's not quite a easy task, e.g. I found this:

http://stackoverflow.com/questions/8408046/how-to-change-the-name-of-a-django-app

I just wonder if there is a util.py to automate renaming a Django app?

Thx!

-- 
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/d5e6f8b2-cb59-4e88-b2c3-1b039f7b19d2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Setting up Django

2016-01-17 Thread ofeyofey
Hi Andrew,
Wow MIT cool!
Thanks for looking at that. I corrected it and ForeignKey which was spelt 
wrong.
All working now. 
I can move on with this tutorial.
Thanks again,

On Saturday, 16 January 2016 21:27:31 UTC, ofeyofey wrote:
>
> Hi,
>
> I am following the Django tutorial on the Django site. Getting errors when 
> i try to make migrations after adding the app to the list of apps in 
> mathGenerator/settings.py
>
> Setting up Django on a raspberry Pi. I don't think the fact that it is on 
> api should make any difference becasue it is basically running.
>
> It is here https://docs.djangoproject.com/en/1.9/intro/tutorial02/
>
> In the previous tutorial I created a project calles mathGenerator and a 
> app called generator.
>
> Created the project with django_admin startproject mathGenerator
>
> Ran the server with $python manage.py runserver
>
> And i can see the site in my browser. So this ia working fine.
>
> Then I created an app called generator using
>
> $python manage.py startapp generator
>
> In generator/nviews.py I put
>
> from django.http import HttpResponse
> code = 
> "body{background-color:rgb(100,0,200);}Django
>  
> test site Hosted on a Raspberry PiPress 
> me!"
> # Create your views here.
> def index(request):
> return HttpResponse(code)
>
> and in generator/urls.py I put
>
> from django.conf.urls import url
> from . import views
>
> urlpatterns = [
> url(r'^$', views.index, name='index'),
> ]
>
> In mathGenerator/urls.py I put
>
> from django.conf.urls import include, url
> from django.contrib import admin
>
> urlpatterns = [
> url(r'^generator/', include('generator.urls')),
> url(r'^admin/', include(admin.site.urls)),
> ]
>
> This works find when I go to
>
> 127.0.0.1:8000/generator
>
> Next I used 
>
> $python manage.py migrate
>
> Then i created a model in generator/models.py
>
> from django.db import models
>
> # Create your models here.
> class Question(models.Model):
> question_text = models.CharField(max_length=200)
> pub_date = models.DateTimefield('date published')
>
> class Choice(models.model):
> question = models.FioreignKey(Question, on_delete=models.CASCADE)
> choice_text = models.CharField(max_length=200)
> votes = models.IntegerField(default=0)
>
> Adding to app to the list of apps in mathGenerator/settings.py
>
> INSTALLED_APPS = [
> 'generator.apps.generatorConfig',
> 'django.contrib.admin',
> 'django.contrib.auth',
> 'django.contrib.contenttypes',
> 'django.contrib.sessions',
> 'django.contrib.messages',
> 'django.contrib.staticfiles',
> ]
>
>
> Then I try to make migrations and I get this error,
>
> pi@raspberrypi ~/DjangoPi/mathGenerator $ python manage.py makemigrations 
> generator
> Traceback (most recent call last):
>   File "manage.py", line 10, in 
> execute_from_command_line(sys.argv)
>   File 
> "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", 
> line 354, in execute_from_command_line
> utility.execute()
>   File 
> "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", 
> line 328, in execute
> django.setup()
>   File "/usr/local/lib/python2.7/dist-packages/django/__init__.py", line 
> 18, in setup
> apps.populate(settings.INSTALLED_APPS)
>   File "/usr/local/lib/python2.7/dist-packages/django/apps/registry.py", 
> line 85, in populate
> app_config = AppConfig.create(entry)
>   File "/usr/local/lib/python2.7/dist-packages/django/apps/config.py", 
> line 112, in create
> mod = import_module(mod_path)
>   File "/usr/lib/python2.7/importlib/__init__.py", line 37, in 
> import_module
> __import__(name)
> ImportError: No module named apps
>
> What am I doing wrong?
>
> Any help would be greatly appreciated,
>
> 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/a1f5ba53-9172-492a-ac8d-b0342cd3c7ba%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.