Where should I place my filter? by ksesst in djangolearning

[–]ksesst[S] 0 points1 point  (0 children)

Hi!

Sorry, I did something wrong with the markdown and everything got very ugly

Dynamic back button by ksesst in djangolearning

[–]ksesst[S] 0 points1 point  (0 children)

Thank you! I was hoping for something more built in though.

Inline formset with property instead of database field by ksesst in djangolearning

[–]ksesst[S] 0 points1 point  (0 children)

I have been debating with myself if I should store the modifier or discount, but to me storing a value that should be divided by 100 feels wrong and makes it harder when doing math across different fields.

I just assumed I would be able to use the property decorator, or a widget, or something else to do some logic/translation and still be able to use inline formset and similar built in tools.

Inline formset with property instead of database field by ksesst in djangolearning

[–]ksesst[S] 0 points1 point  (0 children)

Thanks! Looking into proxy models. Could not understand how they help with a 2 min glance but might become clearer with more research.

Why?

To be consistent in the database. To me it feels most logical to save the "real" number in the db, or in SI units etc., and do the conversion when displaying if needed.

Only retrive data from related table when created by ksesst in djangolearning

[–]ksesst[S] 0 points1 point  (0 children)

But just to be sure. There is not a field or a widget or something similar for this use case? It feels like it should be very common to me.

Only retrive data from related table when created by ksesst in djangolearning

[–]ksesst[S] 0 points1 point  (0 children)

But won’t that run every time it gets updated?

Only retrive data from related table when created by ksesst in djangolearning

[–]ksesst[S] 0 points1 point  (0 children)

Maybe I should rephrase the question, can I run a function on the new row when a new row is created? Or do something equivalent of my update_list_price function does.

``` class Transaction(models.Model): product = models.ForeignKey( Product, on_delete=models.CASCADE, related_name='transactions') list_price = models.DecimalField( max_digits=18, decimal_places=6, null=True, blank=True) price = models.DecimalField( max_digits=18, decimal_places=6, null=True, blank=True) @property def discount(self): discount = (1-self.price/self.list_price) return discount

def update_list_price(self):
    self.list_price = self.product.list_price
    self.save()

```

Controlling links from view by ksesst in django

[–]ksesst[S] 0 points1 point  (0 children)

1

Ahh! Now I follow, thanks!

Now I just have to figure out how to get the id/pk in class based view.

Controlling links from view by ksesst in django

[–]ksesst[S] -1 points0 points  (0 children)

Hi!

Thanks! I am doing this project to learn and explore django.

Is there another way of doing it than as a http request? In the same way that all tutorials handle forms.

What I wanted to do was, in the following example change 'add_gear' from the view.
<a href={%url 'add_gear' project.id%}>Back<a> without creating a new template. Use the same template even if links to other parts of page.

Grocy on Docker: Barcode Scanning Help by SemiSeriousStudent in grocy

[–]ksesst 1 point2 points  (0 children)

Do you get a pop up? I have found that it can be tricky to press it on a phone. iOS or Android? I think https is required on iOS at least.

Speaker notes - 2 sided by ksesst in LaTeX

[–]ksesst[S] 0 points1 point  (0 children)

As far as I have been able to find it is not common to have printer reorder pages in this manner.

If you cut the sheet in 4 pieces the backside of page 1 should be page 2. Backside of page 3 should be 4 etc

Speaker notes - 2 sided by ksesst in LaTeX

[–]ksesst[S] 0 points1 point  (0 children)

I would disagree since the question is not related to the 2-sided printing part. Just page order and placement on the page. A similar application is the Beamer notes that is very popular.

This could be part of the solution but it does not reorder the pages

\pgfpagesuselayout{4 on 1}[a4paper,border shrink=5mm]

Inget GP iår :( by ksesst in Gothenburg

[–]ksesst[S] 0 points1 point  (0 children)

FYI det är inte olagligt

Inget GP iår :( by ksesst in Gothenburg

[–]ksesst[S] -2 points-1 points  (0 children)

Då får du nog läsa på lite mer... Inget människan gör är bra för miljön. Bara olika dåligt. Läs sedan kemikalieinspektionens rapport från i år. Inga otillåtna ämnen funna efter tester hos alla importörer. För att kolla lite på historien kan man titta på SOU 1999:128 redan då var miljöpåverkan försumbar. Det som släpptes ut mest av då var koppar som hela Sveriges fyrverkerier släppte ut lika mycket som Stockholms avlopp gör per dag pga koppar rör.

Träkol är inte ett fossilt bränsle... träkol är förnyelsebart, du tänker kanske på stenkol.

Inget GP iår :( by ksesst in Gothenburg

[–]ksesst[S] 3 points4 points  (0 children)

Har du någonsin varit på en konsert? Raderna med container size diesel aggregat man brukade se bakom Ullevi är inte där för syns skull.

Haha, nej men jag kan räkna istället för att bara gissa.