Possible bug while using migrate or maybe not.

2018-09-18 Thread vineeth sagar
> > So I had a migration which can be found below, so when I was applying the > migration I get this error You can't delete all columns with ALTER TABLE; > use DROP TABLE instead That makes sense because I have only a single > column. When I use the code sample 2 it works nicely. Can anyone

Re: Beginner problem with sqlite3 db

2018-09-18 Thread Mateusz
Cześć! ;) You should first answer a question, why do you even bother using dbshell when there's an other option to deal with data? (docs ) If you know why I'm asking, simply installing sqlite3 is gonna be the best op

Re: How to update if user exist instead of create?

2018-09-18 Thread Mateusz
Just for the record, you should probably consider using CreateView and UpdateView (docs ) if possible. ;) Here is an example (Stack ). W dniu wtorek, 18 września 2018 14:13:20 UTC

Re: Readonly ModelChoiceField of type in model foreignkey

2018-09-18 Thread Mateusz
(use traductor si necesita) I hope I understand your question correctly. When in Django 1.8 or 1.9+ you can just do self.fields['destination'].disabled = True in lower versions you should add self.fields['destination'].widget.attrs['disabled'] = True at the end of your __init__(..). W dniu wto

Re: django-filter over models

2018-09-18 Thread Mateusz
Sorry, my previous answer was senseless, I realized that just after adding it. 1) You can filter jobs in appname/views.py: queryset = Job.objects.filter(name__contains="job") 2) and people in template /appname/templates/jobs_list.html: {% for job in object_list %} {{ job.name }} {% fo

Re: django-filter over models

2018-09-18 Thread Mateusz
In that answer I assume Jobs are connected anyhow with Persons with a ForeignKey field like so: *File /appname/models.py:* from django.db import models class Job(models.Model): name = models.CharField(max_length=100) def __str__(self): return self.name class Person(models.Mo

Re: Running django tests with postgres

2018-09-18 Thread Mike Dewhirst
Bill I'm about to disappear for a few days. Thank you very much for your suggestions - I'll tackle them when I get back. Cheers Mike On 18/09/2018 11:34 PM, Bill-Torcaso-Oxfam wrote: I two comments, and as always Your Milage May Vary. * I wonder if you have the right indexes on your Pos

Django on Heroku + AWS S3 thumbnails & originals

2018-09-18 Thread Mateusz
Hi, I am a newbie in Django so my question may be a little bit odd. I tried looking here, on Stack and also GitHub and trying for 5 hours. I try to host a project on Heroku dyno with AWS S3 as a media storage service (images sent by users). My case may be a bit specific cause I *must *store ori

Re: django ORM with asyncio

2018-09-18 Thread Andrew Godwin
The Django ORM can't just be used with asyncio directly, sadly. The database_sync_to_async function you found there will help you call the ORM from asynchronous code, but it still runs the ORM in a synchronous thread (see https://channels.readthedocs.io/en/latest/topics/databases.html) The project

Readonly ModelChoiceField of type in model foreignkey

2018-09-18 Thread nelson fernando garcia gomez
Hola estoy tratando en mi formulario (formsModel) implementar el atributo de *readonly* a una foreignkey (ModelChoiceField) pero no es posible alguna ayuda por favor GRACIAS así lo estoy haciendo: class CostoForm(forms.ModelForm): """ Edicion de Costos con formset. """ class Meta: model = C

Re: Django Admin Multiple Models and Dropdown list

2018-09-18 Thread mab . mobile . 01
Hi Julio, Thank you so much. I should have picked that up myself. It worked! Thanks again. Marc On Tuesday, September 18, 2018 at 10:30:20 AM UTC-5, Julio Biason wrote: > > Hey Mab, > > You probably need to replace you `__init__` to `__str__`. They are two > different things. > > On Tue, Sep

Re: Django Admin Multiple Models and Dropdown list

2018-09-18 Thread Julio Biason
Hey Mab, You probably need to replace you `__init__` to `__str__`. They are two different things. On Tue, Sep 18, 2018 at 12:18 PM, wrote: > I have the following models and admin files and I would like to be able to > show the text representation of the ExpenseCategory category field in the > d

Django Admin Multiple Models and Dropdown list

2018-09-18 Thread mab . mobile . 01
I have the following models and admin files and I would like to be able to show the text representation of the ExpenseCategory category field in the dropdown list on the Admin page. However, the dropdown list is displaying "ExpenseCategory Object(n)" instead of the actual text category such as

How to get the name and url of an uploaded file when using models.FileField

2018-09-18 Thread Joel Mathew
How to get the name and url of an uploaded file? I am using the following files: settings.py: MEDIA_URL = '/data/' MEDIA_ROOT = os.path.join(BASE_DIR, 'data') urls.py: urlpatterns = [ path("photo/upload", views.upload_pic, name="uploadpic ") ] + static(settings.MEDIA_URL

Re: Running django tests with postgres

2018-09-18 Thread Bill-Torcaso-Oxfam
I two comments, and as always Your Milage May Vary. - I wonder if you have the right indexes on your Postgres database? The previous people report much faster completion times for test that use Postgres as the database. Perhaps your domain is just hard (and you description makes

django ORM with asyncio

2018-09-18 Thread luke lukes
I'm looking for something that can allow the usage of the Django ORM with asyncio (with PostgreSQL). As of now I found only aiopg in the *asyncio ecosystem* , which allows to run raw SQL or to use SQLAlchemy only. I then fou

Re: How to update if user exist instead of create?

2018-09-18 Thread Django Lover
Thanks, Larry for replying. I want to say I am new in Django and I don't know how to use in class-based view, Can you help me to integrate with CBV? On Tuesday, September 18, 2018 at 5:57:28 PM UTC+5:30, larry@gmail.com wrote: > > On Tue, Sep 18, 2018 at 8:13 AM, Django Lover > wrote: > >

Re: How to update if user exist instead of create?

2018-09-18 Thread Larry Martell
On Tue, Sep 18, 2018 at 8:13 AM, Django Lover wrote: > How i can update model when Key exist else create a new one?? > > > My code is- > > **Form.py** > > class UserSettingForm(forms.ModelForm): > class Meta: >model = StUserSetting >fields = ( 'default_language', 'prim

How to update if user exist instead of create?

2018-09-18 Thread Django Lover
How i can update model when Key exist else create a new one?? My code is- **Form.py** class UserSettingForm(forms.ModelForm): class Meta: model = StUserSetting fields = ( 'default_language', 'prim_currency', 'number_format', 'decimal_format', 'date_form

Re: Mysql connector for python 3.7

2018-09-18 Thread suneel singh
If mysqlclient module is not installed than you should we try PyMysql module Or Mysql-connector-python Or Libmysql In python 3.7 On Tue, 18 Sep 2018, 4:55 p.m. , wrote: > Unable to find a connector for python 3.7 on windows > Does anyone know how to get it? > > -- > You received this me

Mysql connector for python 3.7

2018-09-18 Thread rojasrajan85477
Unable to find a connector for python 3.7 on windows Does anyone know how to get it? -- 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...@go