On Mon, May 23, 2016 at 9:20 AM, Larry Martell
wrote:
> They're not identical - there's a timestamp - that is not one of the
> columns compared.
>
> The data is status data from a piece of equipment and we only want to
> store changes. If 2 consecutive rows come in that
On Mon, May 23, 2016 at 12:58 PM, Erik Cederstrand <
erik+li...@cederstrand.dk> wrote:
> Hi,
>
> I have inherited a legacy Item model that has a composite unique key
> consisting of a Customer ID and a per-customer, incrementing Item ID.
> Assume I can't change the model.
>
> On inserts, the
Hello,
did you run manage.py migrate?
When you add a ForeignKey or OneToOne to a model, what actually gets stored
in the DB is the ID of the referenced object (in this case, a
auth.models.User). So the user_id column should be created for you during
the next makemigrations+migrate combo.
On a
> Den 23. maj 2016 kl. 22.49 skrev Ketan Bhatt :
>
> Hey Erik,
>
> What Django version are you on?
I'm on Django 1.9.
Erik
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop
I would make Restaurant.dishes a @property that returns all dishes the
restaurant's chefs can make:
return Dish.objects.filter(chef__restaurant=self)
On May 23, 2016 14:46, "Jani Tiainen" wrote:
> Something like
>
> Chef:
> # Nothing special here, reverse relations will
Hey Erik,
What Django version are you on?
On Tuesday, May 24, 2016 at 1:28:57 AM UTC+5:30, Erik Cederstrand wrote:
>
> Hi,
>
> I have inherited a legacy Item model that has a composite unique key
> consisting of a Customer ID and a per-customer, incrementing Item ID.
> Assume I can't change
Hello All,
I am trying to use reportlab to generate pdfs from html. When I pip install
reportlab it say its installed correctly. However, when I try 'from
reportlab.pdfgen import canvas' I get an error saying no module named
pdfgen. Any ideas to help solve this would be much appreciated.
Hi,
I have inherited a legacy Item model that has a composite unique key consisting
of a Customer ID and a per-customer, incrementing Item ID. Assume I can't
change the model.
On inserts, the legacy code would let the database increment the Item ID to
avoid race conditions. Something like
I have a Users table inside of a postgresql database in which auth_user
also lives. I want the Users objects to have a OneToOne to the auth_user
model. I added a line to my models.py under my Users class:
user = models.OneToOneField(User, unique=True)
There are probably other things wrong,
Can you not do something like
`qs.filter(...info that is coming in...).exists()`
If ^ is True, then update it, otherwise create a new object?
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving
They're not identical - there's a timestamp - that is not one of the
columns compared.
The data is status data from a piece of equipment and we only want to
store changes. If 2 consecutive rows come in that are the same
(excluding the timestamp) I don't want to store the second one.
On Mon, May
OK - I don't really understand that; there should not be any 2 identical
records in a database, but anyway, that was not the issue in this thread.
On Monday, 23 May 2016 11:52:06 UTC+2, larry@gmail.com wrote:
>
> It's only 2 consecutive rows identical rows I need to exclude.
>
> On Mon, May
it would probably be better to use a custom "Func"[1] and a custom "Query
Expression" [2] than user QuerySet.extra
[1] https://docs.djangoproject.com/en/1.9/ref/models/database-functions
[2] https://docs.djangoproject.com/en/1.9/ref/models/expressions/
On Mon, May 23, 2016 at 11:16 AM, Ketan
Take a look at the `extra` method of the queryset in Django. It allows you to
do what you are trying to do by raw SQL.
https://docs.djangoproject.com/en/1.9/ref/models/querysets/#django.db.models.query.QuerySet.extra
Check the above link, the example with `annotate` will be interesting for
Thanks Simon, that's exactly what I needed. I had read the aggregation
documentation, but hadn't figured out how to get it to do what I needed.
Cheers,
Malcolm
On Friday, 20 May 2016 16:52:01 UTC+1, Simon Charette wrote:
>
> Hi Malcom,
>
> I suggest you look into the conditionnal aggregation
Something like
Chef:
# Nothing special here, reverse relations will be done automatically
Dish:
chef = ForeignKey(Chef)
Restaurant:
chefs = ManyToMany(Chef)
dishes = ManyToMany(Dish)
Of course, you need to build something to make sure that restaurant
doesn't serve dishes that
Hi
You can using tutorial from base project, that was what I did to understand.
https://docs.djangoproject.com/en/1.9/intro/tutorial01/
Another way, is was very useful for me the PDF book Pro Django 2nd Version.
But for what I know is:
a) First start with Setting.py,
b) urls to call the view
Hi.
I am looking for a way to find a row which is closest to a specified
point in time, no matter if the row is before or after.
In plain SQL (using SQLite as example), it's very easy to do;
SELECT *,
abs(
strftime('%s','2015-05-21 23:05:00') - strftime('%s',`created`)
) AS timdif
Can you specify what you did! What do you install, and How?
You can clone github, and install since there... You can use easy_install,
pip, and so one.
First what is your platform? Which version. That is basic you get help from
others, we can advice but need your help too.
domingo, 22 de
New to Django. I have some Python programming experience
(beginner-intermediate). I was taking the Django Polls tutorial and can't
resolve deployment problem in the Advanced Tutorial: How to write reuseable
apps: https://docs.djangoproject.com/en/1.9/intro/reusable-apps/
In the Using Your Own
I read the django documentation for a simple many-to-many relationship and
I get it, but I'm stuck with this kind of complexity.
Each restaurant employs many chefs and serves many dishes.
Each chef can work for many restaurants and prepare many dishes.
Each dish can only be prepared by a
Belated thanks for this Erik - that does work nicely. It gets
complicated/annoying trying to untangle other kinds of logging too,
including logging from third-party modules, but that's a separate problem :)
On 9 May 2016 at 21:33, Erik Cederstrand wrote:
>
> > Den 9.
It's only 2 consecutive rows identical rows I need to exclude.
On Mon, May 23, 2016 at 4:53 AM, Derek wrote:
> "When new data comes in I want to ... only add a new row if it differs."
>
> Pardon my curiosity, but isn't that the role of the set of unique keys for
> each
The users will need a browser which is capable of rendering the file or
knowing what app it has to use - for example, on my machine (Linux) an XLS
file is rendered directly by LibreOffice; but on a colleague's machine with
Windows/IE they have to first download the file and then open it. So,
*"When new data comes in I want to ... only add a new row if it differs."*
Pardon my curiosity, but isn't that the role of the set of unique keys for
each record - to determine if it is "different"?
On Friday, 20 May 2016 19:57:38 UTC+2, larry@gmail.com wrote:
>
> On Fri, May 20, 2016 at
You need to let the list know what formats and what technology you are
using to generate the PDF.
When I use rst (reStructuredText) as my input to the generation process,
the markup I use for a Page Break is:
.. raw:: pdf
PageBreak
On Sunday, 22 May 2016 10:57:15 UTC+2, Monu wrote:
>
>
26 matches
Mail list logo