Re: starting afresh

2015-09-22 Thread Alex Kleider

On 2015-09-22 19:04, James Schneider wrote:

Did you delete the previously created migration files?

.
There should be a 'migrations' folder that was created inside of your 
app.

You can whack the whole folder, it will be created next time you run
'makemigrations'.


Indeed, it is there!  (I could have sworn that I had checked but
I must have only looked in the project folder and thought I had
looked in both it and the app folder.
Thank you again and sorry to have bothered.
cheers,
Alex

--
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4c023a21319099ef88be6cf61ab338e7%40sonic.net.
For more options, visit https://groups.google.com/d/optout.


Re: starting afresh

2015-09-22 Thread James Schneider
>> Did you delete the previously created migration files? Django won't ask
>> those questions unless previous migration files exist. If you're starting
>> with a fresh database, you probably should.
>>
>> -James
>
>
> Ah, ha! That must be it.  Much appreciate the tip.
> ...but the problem is I can't find the migration files in order to delete
them.
> Where are they?
> A google search didn't get me far.
> Thanks, Alex

There should be a 'migrations' folder that was created inside of your app.
You can whack the whole folder, it will be created next time you run
'makemigrations'.

-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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2Be%2BciUoHq5_Uu_gHisAM8tkUfhZRzPd%2BFbn4j_iTXgi7AE9Vw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: starting afresh

2015-09-22 Thread Alex Kleider

On 2015-09-22 18:12, James Schneider wrote:



Did you delete the previously created migration files? Django won't ask
those questions unless previous migration files exist. If you're 
starting

with a fresh database, you probably should.

-James


Ah, ha! That must be it.  Much appreciate the tip.
...but the problem is I can't find the migration files in order to 
delete them.

Where are they?
A google search didn't get me far.
Thanks, Alex

--
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/baf7f7495fcaf03609ae5eb67a929411%40sonic.net.
For more options, visit https://groups.google.com/d/optout.


Re: starting afresh

2015-09-22 Thread James Schneider
> Now I have another: I'm unable to make django forget what I've done
before!
>
> I still get the following error:
> """
>  (venv)alex@x301:~/Py/debk$ ./manage.py makemigrations
> Did you rename lineitems.acount to lineitems.dc_type (a CharField)? [y/N]
y
> You are trying to add a non-nullable field 'acnt_number' to lineitems
without a default; we can't do that (the database needs something to
populate existing rows).
> Please select a fix:
>  1) Provide a one-off default now (will be set on all existing rows)
>  2) Quit, and let me add a default in models.py
> Select an option:
> """
> As mentioned before, I deleted my data base but the error persists
>

*snip*

> How does Django even know what was in this file before, let alone why
should it now care?
>

Did you delete the previously created migration files? Django won't ask
those questions unless previous migration files exist. If you're starting
with a fresh database, you probably should.

-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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2Be%2BciUwgWEEP_S7Ri%2BcjAPkceYh6REt2fEw_W7iMgCod8Hbxw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: starting afresh

2015-09-22 Thread Alex Kleider

On 2015-09-22 17:29, Nikolas Stevenson-Molnar wrote:

It's telling you that your default "date" value will be the same for
every instance of "Journal" you create (essentially it'll be the time
when the migration is created), when you probably intend it to be the
time each Journal entry is created.

Try changing default=timezone.now() to default=timezone.now (without
the parens). That should resolve the warning and yield more desirable
behavior. Even better, remove the default and add
auto_now_add=True 
(https://docs.djangoproject.com/en/1.8/ref/models/fields/#django.db.models.DateField.auto_now_add)



Thank you,_Nik.
That did indeed resolve this issue and I am grateful to you.

Now I have another: I'm unable to make django forget what I've done 
before!


I still get the following error:
"""
 (venv)alex@x301:~/Py/debk$ ./manage.py makemigrations
Did you rename lineitems.acount to lineitems.dc_type (a CharField)? 
[y/N] y
You are trying to add a non-nullable field 'acnt_number' to lineitems 
without a default; we can't do that (the database needs something to 
populate existing rows).

Please select a fix:
 1) Provide a one-off default now (will be set on all existing rows)
 2) Quit, and let me add a default in models.py
Select an option:
"""
As mentioned before, I deleted my data base but the error persists

Here's journal/models.py currently:
from django.db import models

ACCOUNT_CODE_LENGTH = 4

class Journal(models.Model):
"""
Each instance represents a journal entry to be stored in the
Journal table.  The automatically created auto-incrementing
primary key serves as the entry number.
"""
date = models.DateTimeField(auto_now_add=True)
user = models.CharField(max_length=24)
description = models.CharField(max_length=256)
def __str__(self):
ret = ["  #{:0>3} on {:<12} by {}."
.format(self.id,
self.date.strftime('%Y-%m-%d %H:%M'),
self.user)]
for line in self.description.split('\n'):
ret.append("{}".format(line))
return '\n'.join(ret)

class LineItems(models.Model):
entry = models.ForeignKey(Journal)
acnt_number = models.CharField(max_length=ACCOUNT_CODE_LENGTH)
dc_type = models.CharField(max_length=1)  # D(ebit or C(redit
amount = models.IntegerField()  # Pennies i.e. $nn.dd * 100
def __str__(self):
if self.dc_type.upper() == 'D':
return ("{:>8}:{:>10,.2f}Dr"
.format(self.acnt_number, self.amount/100.0))
elif self.dc_type.upper() == 'C':
return ("{:>8}:{:>20,.2f}Cr"
.format(self.acnt_number, self.amount/100.0))
else:
return ("Huston, we have a problem!")


How does Django even know what was in this file before, let alone why 
should it now care?



--
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/fcf47bd983b673fca2c308d4f3f63b22%40sonic.net.
For more options, visit https://groups.google.com/d/optout.


Re: starting afresh

2015-09-22 Thread Nikolas Stevenson-Molnar
It's telling you that your default "date" value will be the same for every 
instance of "Journal" you create (essentially it'll be the time when the 
migration is created), when you probably intend it to be the time each Journal 
entry is created.

Try changing default=timezone.now() to default=timezone.now (without the 
parens). That should resolve the warning and yield more desirable behavior. 
Even better, remove the default and add auto_now_add=True 
(https://docs.djangoproject.com/en/1.8/ref/models/fields/#django.db.models.DateField.auto_now_add)

_Nik
On 9/22/2015 5:20:48 PM, Alex Kleider  wrote:
Although at the intermediate level with regard to Python,
I'm just beginning with Django, running Ubuntu 14.4LTS
in a venv established by
$ virtualenv -p python3 venv

I set up a journal app with a models.py file and then
changed some of the fields. Now I can't seem to get rid of
the following warning:
WARNINGS:
journal.Journal.date: (fields.W161) Fixed default value provided.
HINT: It seems you set a fixed date / time / datetime value as default
for this field. This may not be what you want. If you want to have the
current date as default, use `django.utils.timezone.now`

I deleted the db.sqlite3 file thinking that would allow me to start
fresh but somehow django remembers what was there before although it's
not there now:
file journal/models.py:
from django.db import models
from django.utils import timezone

class Journal(models.Model):
"""
Each instance represents a journal entry to be stored in the
Journal table. The automatically created auto-incrementing
primary key serves as the entry number.
"""
date = models.DateTimeField(default=timezone.now())
user = models.CharField(max_length=24)
description = models.CharField(max_length=256)
def __str__(self):
ret = [" #{:0>3} on {:<12} by="" {}."="">
.format(self.id,
self.date.strftime('%Y-%m-%d %H:%M'),
self.user)]
for line in self.description.split('\n'):
ret.append(" {}".format(line))
return '\n'.join(ret)

Any advice would be appreciated.
Alex

--
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/25bfa6241296e00dca1e76be74a85e04%40sonic.net.
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ff412899-279f-4747-b09d-c2a2d56e1462%40getmailbird.com.
For more options, visit https://groups.google.com/d/optout.


starting afresh

2015-09-22 Thread Alex Kleider

Although at the intermediate level with regard to Python,
I'm just beginning with Django, running Ubuntu 14.4LTS
in a venv established by
$ virtualenv -p python3 venv

I set up a journal app with a models.py file and then
changed some of the fields.  Now I can't seem to get rid of
the following warning:
WARNINGS:
journal.Journal.date: (fields.W161) Fixed default value provided.
	HINT: It seems you set a fixed date / time / datetime value as default 
for this field. This may not be what you want. If you want to have the 
current date as default, use `django.utils.timezone.now`


I deleted the db.sqlite3 file thinking that would allow me to start 
fresh but somehow django remembers what was there before although it's 
not there now:

file journal/models.py:
from django.db import models
from django.utils import timezone

class Journal(models.Model):
"""
Each instance represents a journal entry to be stored in the
Journal table.  The automatically created auto-incrementing
primary key serves as the entry number.
"""
date = models.DateTimeField(default=timezone.now())
user = models.CharField(max_length=24)
description = models.CharField(max_length=256)
def __str__(self):
ret = ["  #{:0>3} on {:<12} by {}."
.format(self.id,
self.date.strftime('%Y-%m-%d %H:%M'),
self.user)]
for line in self.description.split('\n'):
ret.append("{}".format(line))
return '\n'.join(ret)

Any advice would be appreciated.
Alex

--
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/25bfa6241296e00dca1e76be74a85e04%40sonic.net.
For more options, visit https://groups.google.com/d/optout.


Re: Strategies for Speeding Up Django 1.8 Tests?

2015-09-22 Thread Richard
If you're not changing the schema, you could try using the "-k" option to 
keep the database between tests. This way it doesn't have to recreate it 
and the indexes each time you run your tests.

On Tuesday, 22 September 2015 11:22:51 UTC-6, Robert F. wrote:
>
> Does anyone have any strategies or techniques for running their unit tests 
> faster in Django 1.8?  My project has seven model modules containing 
> twenty-one models (none of which are very complex).  I run my tests using 
> the default Django test runner on a 1.86 GHz Mac laptop with 4 GB of RAM 
> against a local PostgreSQL 9.4.4 database.  I'm finding that after 
> upgrading to Django 1.8, my test suite takes longer to start up (about 
> 10-11 seconds) than it takes to run the 180+ tests themselves (about 9 
> seconds).  I know one strategy would be to use SQLite for testing but I'd 
> prefer to run against my actual database server.  I'm also using the 
> django-test-without-migrations 
>  package to 
> avoid running migrations but that only speeds things up a little.  Is there 
> anything else I can do?  The longer startup time for tests in Django 1.8 
> really makes it difficult to do true test-driven development.
>
> 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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7b265e90-ca9f-43fe-8141-0155a790cfbb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Reverse for 'post_detail' with arguments '()' and keyword arguments '{'pk': 1}' not found. 1 pattern(s) tried:

2015-09-22 Thread Luis Zárate
2015-09-22 12:48 GMT-06:00 sankar vasu :

> {{ post.title }}


try:

{{ post.title }}

If not found then check your project url.py , do you have something like


urlpatterns = [
url(r'^$', include('myapp.urls') ),

]
-- 
"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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAG%2B5VyPXAjmyVWj5jJzvX70%2BE0%3DLaAaXW4DpvoUdyLqrONxOpA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Reverse for 'post_detail' with arguments '()' and keyword arguments '{'pk': 1}' not found. 1 pattern(s) tried:

2015-09-22 Thread sankar vasu
Dear Luis,

FYI:

post_detail.html
---
{% extends "blog/base.html" %}

{% block content %}

{% if post.published_date %}

{{ post.published_date }}

{% endif %}
{{ post.title }}
{{ post.text|linebreaks }}

{% endblock %}

post_list.html

{% extends "blog/base.html" %}
{% block content %}
{% for post in posts %}

{{ post.title
}}
{{ post.text|linebreaks }}
Web published: {{ post.published_date
}}

{% endfor %}
{% endblock content %}

Thanks in Advance,
Sankar B

On Tue, Sep 22, 2015 at 8:32 AM, Luis Zárate  wrote:

> The error is in the template, please check the url statement inside the
> template.
>
> Or share with ours the template file.
>
> El sábado, 19 de septiembre de 2015, sankar vasu 
> escribió:
> > Hi All,
> >
> > I got below error, please advise. please look at the following link:
> http://pysan.pythonanywhere.com/
> >
> >
> 
> >
> >
> > url.py
> >
> > from django.conf.urls import url
> > from . import views
> >
> > urlpatterns = [
> > url(r'^$', views.post_list, name='post_list'),
> > url(r'^post/(?P[0-9]+)/$', views.post_detail,
> name='post_detail'),
> > ]
> >
> >
> > view.py
> >
> > from django.shortcuts import render, get_object_or_404
> > from django.utils import timezone
> > from .models import Post
> >
> > def post_list(request):
> > posts =
> Post.objects.filter(published_date__lte=timezone.now()).order_by('published_date')
> > return render(request, 'blog/post_list.html', {'posts': posts})
> >
> > def post_detail(request, pk):
> > post = get_object_or_404(Post, pk=pk)
> > return render(request, 'blog/post_detail.html', {'post': post})
> >
> >
> > Thanks in advance,
> > Sankar B
> >
> > --
> > 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 http://groups.google.com/group/django-users.
> > To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAPzi0vCzoaSN%2B6xEL%3D%2BPSu_vQMpqG6i8oFw9y4_mtPvO8xtoeg%40mail.gmail.com
> .
> > For more options, visit https://groups.google.com/d/optout.
> >
>
> --
> "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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAG%2B5VyOjk899wEAdjmMaZSGKc9tYQHDmUL%2Bc-3NTtDEF6kNEKw%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
By,

Sankar

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPzi0vB8Mjr%2BeEsCb6qTuCNKm%2Bzn9MFnSr8_8%2BK%3D0f0Km490Xw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Entry.objects.filter(pub_date__month=7) doesn't work with Django 1.8

2015-09-22 Thread Bill Freeman
What does the following say?

   Entry.objects.filter(pub_date__year=2015)[0].pub_date.month

If it says 7, then its time to delve into the generated SQL for the month
query.

On Tue, Sep 22, 2015 at 10:52 AM, lxm  wrote:

> I create a class named Entry,like this:
>
>> class Entry(models.Model):
>
> pub_date = models.DateTimeField()
>>
> this data table named Entry have one record:
>
>- pub_date = '2015-7-14 xx:xx:xx'
>
> then,I excute 'Entry.objects.filter(pub_date__year=2015)' in shell,this
> will return right result,
> but when I excute 'Entry.objects.filter(pub_date__month=7)',this return
> empty list.
>
> --
> 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/b29a0450-f0c6-421a-be33-770338f5965d%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAB%2BAj0tsYKWaL%2BS_6rwm87BDvcmDLQRg9Zu79hGuXExzo16Khg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Strategies for Speeding Up Django 1.8 Tests?

2015-09-22 Thread Robert F.
Does anyone have any strategies or techniques for running their unit tests 
faster in Django 1.8?  My project has seven model modules containing 
twenty-one models (none of which are very complex).  I run my tests using 
the default Django test runner on a 1.86 GHz Mac laptop with 4 GB of RAM 
against a local PostgreSQL 9.4.4 database.  I'm finding that after 
upgrading to Django 1.8, my test suite takes longer to start up (about 
10-11 seconds) than it takes to run the 180+ tests themselves (about 9 
seconds).  I know one strategy would be to use SQLite for testing but I'd 
prefer to run against my actual database server.  I'm also using the 
django-test-without-migrations 
 package to 
avoid running migrations but that only speeds things up a little.  Is there 
anything else I can do?  The longer startup time for tests in Django 1.8 
really makes it difficult to do true test-driven development.

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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/72fd74d1-15e7-432d-a11c-82af231ce4ae%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django/Python Developers

2015-09-22 Thread Monika Otulakowska
Helo Everybody,

I'm looking for Django/Python developers for startup with location in Posen 
(Poland). 

Here you can find more information but in polish language: 
http://makemymind.pl/oferty/python_developer.pdf

Here you can send me application: monika.otulakow...@makemymind.pl


-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5315f2e5-45d1-41b4-8488-682aff4c48c6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Entry.objects.filter(pub_date__month=7) doesn't work with Django 1.8

2015-09-22 Thread lxm
I create a class named Entry,like this:

> class Entry(models.Model):

pub_date = models.DateTimeField()
>
this data table named Entry have one record:

   - pub_date = '2015-7-14 xx:xx:xx'
   
then,I excute 'Entry.objects.filter(pub_date__year=2015)' in shell,this 
will return right result,
but when I excute 'Entry.objects.filter(pub_date__month=7)',this return 
empty list.

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/b29a0450-f0c6-421a-be33-770338f5965d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Testcase raise "OperationalError: no such table" when there are some SystemCheckError

2015-09-22 Thread 朱涧江
class TicketReview(models.Model):
user = models.ForeignKey(User, null=True)
admin_user = models.ForeignKey(
User, #related_name="admin_user",#here is SystemCheckError
null=True) 


Maybe there can be some friendly error raise,rather than raise ` 
OperationalError: no such table`

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/9989e878-f052-410d-8508-33858f8baee5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Forms questions

2015-09-22 Thread 'Tom Evans' via Django users
On Tue, Aug 25, 2015 at 6:10 PM, Hugo Kitano  wrote:
>
> Here it is, very simple:
>
>  Submit form: 
> 
> {% csrf_token %}
> {{ form.as_p }}
> 
> 
>

Read this section of the manual, particularly the section starting
"Firstly, ...". The problems yo uare having are that you aren't
telling Django there are files to read in the POST, and even if the
files were being read from the POST, you aren't passing them to the
form.

https://docs.djangoproject.com/en/1.8/ref/forms/api/#binding-uploaded-files-to-a-form

Cheers

Tom

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFHbX1J3meKf%3Dafo30Z4%3DtsE3LOMngN198ufEDVcb1cCxajaSA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Reverse for 'post_detail' with arguments '()' and keyword arguments '{'pk': 1}' not found. 1 pattern(s) tried:

2015-09-22 Thread Remco Gerlich
According to the error, your pattern starts with $, which is an obvious
mistake.

But the "url.py" you quote has ^.

Maybe it was using an old version, or you haven't copied the right one.

Greetings,
Remco Gerlich


On Sat, Sep 19, 2015 at 9:42 AM, sankar vasu  wrote:

> Hi All,
>
> I got below error, please advise. please look at the following link:
> http://pysan.pythonanywhere.com/
>
> [image: Inline image 1]
>
>
>
>
> *url.py*from django.conf.urls import url
> from . import views
>
> urlpatterns = [
> url(r'^$', views.post_list, name='post_list'),
> url(r'^post/(?P[0-9]+)/$', views.post_detail, name='post_detail'),
> ]
>
>
>
>
> *view.py*from django.shortcuts import render, get_object_or_404
> from django.utils import timezone
> from .models import Post
>
> def post_list(request):
> posts =
> Post.objects.filter(published_date__lte=timezone.now()).order_by('published_date')
> return render(request, 'blog/post_list.html', {'posts': posts})
>
> def post_detail(request, pk):
> post = get_object_or_404(Post, pk=pk)
> return render(request, 'blog/post_detail.html', {'post': post})
>
>
> Thanks in advance,
> Sankar B
>
> --
> 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAPzi0vCzoaSN%2B6xEL%3D%2BPSu_vQMpqG6i8oFw9y4_mtPvO8xtoeg%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 group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFAGLK1hvR4aU%3DsJ-YFrxivs6QxdpZk1LsgDZKN5JbZ3h6sOnA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.